YII多表关联查询
->select("{{%relation_detail}}.name") ->from("{{%user}}") ->leftJoin("{{%relation_user}}", "{{%user}}.user_id = {{%relation_user}}.id") ->leftJoin("{{%relation_detail}}", "{{%relation_user}}.user_name = {{%relation_detail}}.user_name") ->all();
yii2打印上次执行的sql语句
$driver=Driver::find(); $driver->.........//执行的操作 $sql=$driver ->createCommand()->getRawSql(); var_dump($sql);die;
原文地址:https://www.cnblogs.com/gaocy/p/9750571.html
时间: 2024-10-10 10:16:50