On Wed, Oct 14, 2009 at 5:00 PM, BeroFX <ber...@gmail.com> wrote: > > How can I select records where a column doesn't contain any value, > like ''. > > Doing it like this $this->Document->find('all', array > ('conditions'=>array('Document.title'=>''))); produces a WHERE > `Document`.`title` = NULL query and that's not right. > > What I need is a WHERE title='' query returned.
You could test for 0 length: 'conditions' => array('CHAR_LENGTH(Document.title) = 0') But it'd be simpler to just ensure that an empty title is always NULL in the first place. --~--~---------~--~----~------------~-------~--~----~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---