Reputation: 11
Anyone knows how to create a model for this kind of query in cakephp?
select * from (select a,b,c from table1 where a = 'something') as table_alias group by b;
Wherein the inner table is a temp table where i can still pass some conditional arrays (instead of using the ->query() function).
Thanks in Advance!
Upvotes: 1
Views: 395
Reputation: 25698
It's documented in the manual including examples. You need to use buildStatement() and expression().
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#sub-queries
Upvotes: 2