If you want to sort on the column as well, I suggest you create a
"counter cache". Basically, you store the count of subitems in a field
in the main table, which is updated on create/update/delete.

There is even a behaviour that can do this automatically for you.

http://bakery.cakephp.org/articles/view/countercache-or-counter_cache-behavior

Cheers,
Adam

On Feb 25, 3:02 pm, Andrew Allen <[EMAIL PROTECTED]> wrote:
> This may be silly since there is a better to do this I'm sure, but is
> there a way to count the number of items in a subselect on pagination?
> Or is there a way to count the number of items that are linked in a
> hasMany relationship. i.e. can you output the number of comments that
> are associated with a post in a blog?
>
> Thank you in advance.
>
> Sincerely,
> ~Andrew Allen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to