Ive seen some people do this, but forgot exactly how it should be
written. Im looking to grab a "total/count" for items within a query.
For instance, if Im grabbing a list of blog entries, I also want to
get a total of how many comments each entry has. Instead of doing a
loop and doing more queries, Ive seen it written within the find it
self.

find('all', array('fields' => array('*', 'SELECT COUNT(id) AS count
FROM comments WHERE id = $)));

Is that how you do it?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to