1
大家好我有以下查詢來執行。我執行它作爲一個字符串的SQL,但有什麼辦法,我可以把它轉換成標準格式或Yii中正確的命令格式...在yii中用子查詢創建查詢
$sql="select * from costing inner join
(select * from storage inner join costing_user_binding psb on user.user=psb.fk_user_id where user.fk_users_id IN $parents_id)
view on costing.costing_id=view.fk_costing_id where costing.fk_user_types_id = {$session['role_level']} and costing.fk_product_types_id=2";
$result = Yii::app()->db->createCommand($sql)->queryAll();
這太棒了......謝謝 – user3089273
嘿子查詢是否正常sql? – user3089273
oops ...對不起..它的哎呀..對不起..它的$ subQuery = $ model-> getCommandBuilder() - > createFindCommand($模型 - > getTableSchema(),$標準) - > getText(); – Dirgh