table1
---+---------
id | value
---+---------
1 | (NULL)
2 | 'string'
3 | (NULL)
table2
---+-----------
id | table1_id
---+-----------
1 | 3
我可以得到我的结果通过执行MYSQL - 加入不同的条件(为null与is not null)表,而工会
select table1.id from table1 where table1.value is not null
union
select table1.id from table1 right join table2 on table1.id=table2.table1_id
所以我需要得到的是
---+--
id |
---+--
2 |
3 |
但我不能使用工会,因为我应该使用yii1.1 CDbCriteria不支持工会 我试过不同的连接类型,但没有结果。
很酷,它的工作原理!谢谢! –