$sql = Wrong::find()->where([
't.fdUserID' => 4,
't.fdStatus' => 0
])->alias('t')->leftJoin(Exercise::tableName().' exercise','exercise.id=t.fdExerciseID',['exercise.fdStatus'=>1]);
print_r($sql->createCommand()->getRawSql());
打印的sql语句为
SELECT `t`.* FROM `tbWrong` `t` LEFT JOIN `tbExercise` `exercise` ON exercise.id=t.fdExerciseID WHERE (`t`.`fdUserID`=4) AND (`t`.`fdStatus`=0)
请问下exercise.fdStatus=1这个条件为啥没生成,还有如何生成期望的sql语句
SELECT `t`.* FROM `tbWrong` `t` LEFT JOIN `tbExercise` `exercise` ON (exercise.id=t.fdExerciseID AND exercise.fdStatus=1) WHERE (`t`.`fdUserID`=4) AND (`t`.`fdStatus`=0)