yii中打印sql

$listsArray = (new yii\db\Query())
    ->select('*')
    ->from('tablea AS a')
    ->leftJoin('tableb AS b', 'a.consultant = b.consultant')
    ->where("a.begin_at_plan < $endTime")
    ->orderBy(["FIELD(a.status,1,0,3,2)"=>true, 'a.begin_at_plan'=>SORT_DESC]);
    var_dump($listsArray->createCommand()->getRawSql());die;
//                ->all();

猜你喜欢

转载自blog.csdn.net/alashan007/article/details/80405912