Re: Converting SQL query to Cake query

2009-03-07 Thread jason m
for me. -- View this message in context:http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context:http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from

Re: Converting SQL query to Cake query

2009-03-07 Thread RyOnLife
' = array('Post.view_count DESC'), 'limit' = 10 ) ); this worked for me. -- View this message in context:http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context:http

Re: Converting SQL query to Cake query

2009-03-06 Thread Miles J
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. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Converting SQL query to Cake query

2009-03-06 Thread RyOnLife
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

Re: Converting SQL query to Cake query

2009-03-06 Thread Stu
$topTen = $this-Post-find('list', array( 'fields' = array('Post.id', 'Post.view_count'), 'order' = array('Post.view_count DESC'), 'limit' = 10 ) ); this worked for me. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Converting SQL query to Cake query

2009-03-06 Thread RyOnLife
. -- View this message in context: http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p2436388.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Converting SQL query to Cake query

2009-03-06 Thread grigri
', array( 'fields' = array('Post.id', 'Post.view_count'), 'order' = array('Post.view_count DESC'), 'limit' = 10 ) ); this worked for me. -- View this message in context:http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from the CakePHP mailing list archive

Re: Converting SQL query to Cake query

2009-03-06 Thread RyOnLife
) ); this worked for me. -- View this message in context:http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://n2.nabble.com/Converting-SQL-query-to-Cake-query

Re: Converting SQL query to Cake query

2009-03-06 Thread RyOnLife
', array( 'fields' = array('Post.id', 'Post.view_count'), 'order' = array('Post.view_count DESC'), 'limit' = 10 ) ); this worked for me. -- View this message in context:http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from the CakePHP mailing list

Re: Converting SQL query to Cake query

2009-03-06 Thread RyOnLife
.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p2437599.html Sent from the CakePHP mailing list archive

Re: Converting SQL query to Cake query

2009-03-06 Thread RyOnLife
) ); this worked for me. -- View this message in context:http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p243... Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://n2.nabble.com/Converting-SQL-query-to-Cake

Converting SQL query to Cake query

2009-03-05 Thread RyOnLife
Hello, I am having trouble converting this SQL query to a Cake query that uses find(): SELECT Page.*, COUNT(*) AS views FROM pages AS Page INNER JOIN page_views AS PageView ON Page.id = PageView.page_id GROUP BY Page.id ORDER BY COUNT(*) DESC LIMIT 10 OFFSET 0 This is what I've got