cakePHP and GROUP BY
Posted
by Lizard
on Stack Overflow
See other posts from Stack Overflow
or by Lizard
Published on 2010-05-28T14:04:42Z
Indexed on
2010/05/28
15:42 UTC
Read the original article
Hit count: 273
I am trying to solve a hopefully simple problem here is the query I am trying produce:
SELECT `categories`.*, COUNT(`entities`.id)
FROM `categories`
LEFT JOIN `entities` ON (`categories`.`id` = `entities`.`category_id`)
GROUP BY `categories`.`id`
I am really struggling to do this is in cakePHP 1.2
How would/should I go about doing this... (I am using 'Containable' if that helps)
Thanks in advance
© Stack Overflow or respective owner