I might be misunderstanding what you are expecting as a result set,
but you could simply do:
$this->Movement->find('count', array(
'conditions' => array(
'Movement.status'=> array(11,12)
),
'recursive' => -1
));
This would produce the query:
SELECT COUNT(*) AS `count` FROM `movements` AS `Movement` WHERE
`Movement`.`type` IN (11,12);
Which is equivalent (in a boolean logic sense) to the query that I
think you are attempting to construct.
-Joel.
On May 29, 12:40 pm, propellorcut <[EMAIL PROTECTED]> wrote:
> I'm trying to find the number of records returned based on a certain
> column having the value 11 or 12. I think I'm writing this correctly,
> but cake doesn't like the fact that I have an OR statement based on 1
> column.
>
> this statement:
>
> $outstanding = $this->Movement-
>
> >find('count',array('conditions'=>array('OR'=>array('Movement.status'=>11,'Movement.status'=>12)),'recursive'=>-1));
>
> produces this query:
>
> SELECT COUNT(*) AS `count` FROM `movements` AS `Movement` WHERE
> ((`Movement`.`status` = 12))
>
> I've tried changing this up a bit and have 2 different columns:
>
> $outstanding = $this->Movement-
>
> >find('count',array('conditions'=>array('OR'=>array('Movement.type'=>11,'Movement.status'=>12)),'recursive'=>-1));
>
> produces:
>
> SELECT COUNT(*) AS `count` FROM `movements` AS `Movement` WHERE
> ((`Movement`.`type` = 11) OR (`Movement`.`status` = 12))
>
> This leads me to believe I'm writing this correctly, cake just won't
> do the OR statement on a single column.
>
> Anyone have any ideas? Otherwise I'll just manually write the query,
> but I wanted to do it properly.
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---