select *
from paymentDetails
where payment_date=date and employee.designation.desig_id=2;
这不会在SQL工作,要么,是东阳您正在使用的表employee和指定和你实际上并没有以任何方式加入他们的行列。
现在你还没有给我们关于该机型的名称的任何细节,但它应该是类似
$paymentDetails = PaymentDetails::find()->joinWith('employee.designation')-where(['employee.designation.desig_id' => 2, 'payment_date' => 'date'])->all();
这将执行 SELECT * 从paymentDetails JOIN员工在“theDefinedRelation”加入指定ON 'theSecondDefinedRelation'其中payment_date = date和employee.designation.desig_id = 2;
无论如何,这将是一个漫长的一天,如果你不知道为什么SQL失败,你必须先了解SQL。
把你想要的'from'子句中使用的表。 – 2014-11-24 12:37:36
列* employee.designation.desig_id *在表中不存在* paymentDetails * – 2014-11-24 12:38:57
paymentDetails表具有与雇员一一对应的关系和雇员具有指定的关系。 – karanlv00012 2014-11-24 12:50:16