yii framework, how to implement union sql

2019-09-07 10:45发布

问题:

i am trying to do something like this on yii actionAdmin()

select * from car where carbrand = 'bmw' limit 1
union
select * from car where carbrand = 'mercedez'

i cannot find anything to do with union on CDbCriteria

Is there any other way?

回答1:

U can try to merge criteria with another one http://www.yiiframework.com/doc/api/1.1/CDbCriteria#mergeWith-detail or u can use DAO and CDbCommand http://www.yiiframework.com/doc/api/1.1/CDbCommand#union-detail.



标签: php yii