A good way to do this is to add posts.comment_count field to your database and add counterache to the model like :
http://book.cakephp.org/view/816/counterCache-Cache-your-count Andras Kende On Nov 23, 2009, at 12:10 AM, death.au wrote: > But I'm not using mysql, I am using the paginator helper's built in > functions... > > On Nov 23, 4:00 pm, Dave <[email protected]> wrote: >> In MySQL you use the GROUP BY keyword to accomplish this >> >> On Sun, Nov 22, 2009 at 7:44 PM, death.au <[email protected]> wrote: >>> I've been looking around, and haven't been able to find anything on >>> this at all, and I was wondering if it was even possible to sort by a >>> count of related models using the paginator. >> >>> Using the basic blog example, I would like to list all posts with the >>> paginator, sorted by the number of comments. Is there any way to do >>> this currently? >> >>> In future I would also like to sort by things like average rating and >>> other aggregates, but I thought I'd begin with the basics. >> >>> -- >> >>> You received this message because you are subscribed to the Google Groups >>> "CakePHP" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<cake-php%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/cake-php?hl=. > > -- > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/cake-php?hl=. > > -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cake-php?hl=.
