Yii:如何使用CDbCriteria创建sql

时间:2014-12-04 02:49:18

标签: yii

SQL是:

select name, value from config where parent_id in ( select id from config where
name = 'Yii');

1 个答案:

答案 0 :(得分:1)

我不确定您的情况,但尝试在条件字段

上添加子查询
$criteria = new CDbCriteria();
$criteria->select ='name, value';
$criteria->addCondition( select id from config where name = 'Yii');