could anyone translate this sql statement into CDbCriteria ?
select approval.*, commission_form.form_id from approval, commission_form where approval.refer_id = commission_form.form_id and approval.type = "CommissionRequest" and 2 = (select status from approval where type = "CommissionRequest" and refer_id = commission_form.form_id order by ordering desc limit 1) group by commission_form.form_id order by commission_form.form_id desc
below is my code :
$criteria->condition = '$status = (select status from approval where type = "CommissionRequest" and refer_id = t.form_id order by ordering desc limit 1)';
i have tried several times and always got this error "Invalid parameter number: number of bound variables does not match number of tokens"