Re: How to use "not in" in new find() ?
ups sorry it works as expected, thanks ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use "not in" in new find() ?
On Wed, Apr 23, 2008 at 3:44 AM, rob30 <[EMAIL PROTECTED]> wrote: > > I've tried > > 'conditions' => array('not' => array('id' => $model_ids; > but its not ok :( > it generates: WHERE NOT ((`id` IN (2, 5) )) > Of course it works. Let's say I have a table called 'teams'. ibl_stats=# select count(*) from teams; count --- 1517 (1 row) So tell me what the difference between these statements are: ibl_stats=# SELECT COUNT(*) FROM teams WHERE id NOT IN (2479, 2485); count --- 1515 (1 row) ibl_stats=# SELECT COUNT(*) FROM teams WHERE NOT (id IN (2479, 2485)); count --- 1515 (1 row) Looks the same to me. -- Chris Hartjes Internet Loudmouth Motto for 2008: "Moving from herding elephants to handling snakes..." @TheKeyBoard: http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use "not in" in new find() ?
I've tried 'conditions' => array('not' => array('id' => $model_ids; but its not ok :( it generates: WHERE NOT ((`id` IN (2, 5) )) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use "not in" in new find() ?
Try: $this->Model->find('list', array('fields' => array('id', 'name'), 'conditions' => array('not' => array('id' => $model_ids; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to use "not in" in new find() ?
Hi, How to use "not in" in new find() syntax? "in" is working fine $this->Model->find('list', array('fields' => array('id', 'name'), 'conditions' => array('id' => $model_ids))); generates: SELECT `Model`.`id`, Model`.`name` FROM `models` AS `Model` WHERE `id` IN (2, 5) but how to generate WHERE `id` NOT IN (2, 5) Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---