如何在yii2中将该查询转换为ActiveQuery?
SELECT * from table1 natural join table2 natural join table3
答案 0 :(得分:1)
假设表Table1与模型类Model1相关联,并且自然连接的列名为id
$model = Model1::find()
->innerJoin('Table2', 'table1.id = Table2.id' )
->innerJoin('Table3', 'table1.id = Table3.id' )
->all();