Thanks, but that doesn't address the issue. Removing the condition does not make the Cake query match the SQL query (or a LEFT JOIN equivalent).
The normalized database has a views table that contains a record of each individual visit to a page. I do have my Cake associations properly setup: Page hasMany View and View belongsTo Page. I am trying to retrieve the top 10 most viewed pages, sorted by most number of views. I know how to do it in SQL (as pasted above), just can't figure out the Cake. Miles J wrote: > > > Remove that condition, you should be using associations instead. Once > you have an association, all related data will be returned, simply > contain it or up the recursion. > > > > -- View this message in context: http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p2435579.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---