简体   繁体   中英

Create temp table in cakephp select

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM