如何在 YIi 中将自定义查询转换为 CDbCriteria。我试过这样,也许不完整:
$criteria=new CDbCriteria;
$criteria->select='t.kode, t.status, p.berlaku_punish AS p_berlakupunish,p.nilai AS p_nilai';
$criteria->join = 'LEFT JOIN punish p ON (p.id_status = t.id)';
myquery : `$sql="SELECT status.id, status.kode, status.status, m1.berlaku_punish, m1.nilai
FROM STATUS LEFT JOIN punish m1 ON status.id = m1.id_status
AND m1.id = ( SELECT MAX( m2.id ) FROM punish m2 WHERE m2.id_status = status.id)";`
如何在 myquery 中插入AND到我的自定义不完整 CDbCriteria 中?对不起,关于我的英语。