views:

32

answers:

1

Hello everyone,

I am totally lost in implementing the following sql using cakephp ORM

SELECT *
FROM users
WHERE users.id NOT
IN (

SELECT potentials.user_id
FROM potentials
)

I have tried this but it is not working at all

$this->User->find('all', array(
            'contain' => array(
                'City' => array(
                    'fields' => array('id', 'name')
                )
            ),
            'conditions' => array(
                'NOT IN' => array('Select user_id from potentials')
            )
        ));

I have also tried this method mentioned on the book.cakephp.org but it didn't proved of much help.

Please help me write this query in cakephp way.

Thanks

A: 

I think this will help you.

Xenon
If the answer to my question was so simple that could be easily found in the cakephp's manual/book then I wouldn't have posted it here. Btw thanks for your kind help. I already had a look at that section. Posted my question only when I wasn't able to find an answer.
Gaurav Sharma