On Fri, May 7, 2010 at 7:16 AM, Eleazar <gerrit.kru...@gmail.com> wrote:
> Hello
> for the life of me I coudn't find an example of how to do the
> following:
> SELECT * FROM (SELECT * FROM mytable WHERE some_id=1 ORDER BY DATE
> DESC) t1 GROUP BY block_id
>
> The query needs to select the latest entries for each block_id in the
> table (like selecting the latest comment for each blog post would be
> an equivalent scenario).
>
> I would need to implement this with pagination, but I would just like
> to get it to work with find() for now.
>
> Is a custom query maybe the only way to do this?


Check the sub-query item at

http://book.cakephp.org/view/74/Complex-Find-Conditions

Best regards.

-- 
MARCELO F ANDRADE
Belem, Amazonia, Brazil

"I took the red pill"

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to