Hi, can anyone tell me, how to retrieve joined result from multiple tables in cakePHP from using cakePHP mvc architecture. For e.g., I've three tables to join (tbl_topics, tbl_items, tbl_votes. There relationship is defined as, a topic can have many items and an item can have many votes). Now I want to retrieve list of topics with the count of all votes on all items for each topic. SQL query for the same is written below : Select Topic.*, count(Vote.id) voteCount from tbl_topics as Topic Left Outer Join tbl_items as Item ON( Topic.id = Item.topic_id ) Left Outer Join tbl_votes as Vote ON( Item.id = Vote.item_id );
My problem is I can do it easily using $this->Model->query function, but this require sql code to be written in controller which I don't want. I'm trying to find out any other cakePHP function like find() for doing the same. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---