I have thee following simple model:
I'm trying to get counts of items, grouped by catalogitem, for a certain section- the equivalent of:
SELECT catalogitem.id, count(*) FROM section LEFT JOIN catalogitem ON section.id=catalogitem.section_id LEFT JOIN item ON item.catalogitem_id=catalogitem.id WHERE section.id=5 GROUP BY catalogitem.id
So simple in sql, yet I can't get it to work with cake models. Can anyone point as to how to do it with cake models, using the model->find? I can't get it to group by correctly or join correctly on 3 tables :(
Edit: highly prefer to get the info in single query