For some reason this query is pulling more results then that which is
possible.

I am running a contain 
 
$params = array('contain' => false,
      'conditions' => array(             
             'Post.status' => 0,
             'Post.rank <=' => $rank,
               $sql
             ),
      'fields' => array('Post.id'));
 
which produces this 
 
SELECT `Post`.`id` FROM `posts` AS `Post` WHERE `Post`.`status` = 0 AND
`Post`.`rank` <= 0 AND `Post`.`title` LIKE '%mary%' OR `Post`.`description`
LIKE '%mary%'

So I get these id's returned

Array
(
    [0] => 139ea7
    [1] => 2a4370
    [2] => 3fb952
    [3] => 66bfb4
    [4] => 8197d5
    [5] => 87c28a
    [6] => 97fd0f
    [7] => a78629
    [8] => cbe69d
    [9] => e9915c
)

Yet there are only 5 Posts in the db that have a rank of 0,  seems like its
ignoring the rank and status and just and pulling the `Post`.`title` LIKE
'%mary%' OR `Post`.`description` LIKE '%mary%'

Any ideas why? Or how to only get id's where I am going wrong here?
 
Dave 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to