我正在尝试从
user_request_wallet
表中lead_developer=?然后回答什么?或者是?我想加入
mainRequest
它应该怎么指挥???
我试了两种方法,但没有成功
//$model = UserRequestWallet::find()->Where(['and',['lead_developer' => $getUser]])
//->andWhere(['and',['answer_tocall' => 'accepted']])
//->andWhere(['or',['answer_tocall' => 'putonhold']])
//->joinWith('mainRequest');
$model = (new \yii\db\Query())
->select('*')
->from('user_request_wallet')
->andwhere(['lead_developer'=> $getUser])->andWhere(['answer_tocall' => 'accepted'])
->orWhere(['answer_tocall'=>'putonhold'])->leftJoin('mainRequest');
Exception (Database Exception) 'yii\db\Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE ((`lead_developer`=7) AND (`answer_tocall`='accepted')) OR (`answer_tocall' at line 1
正在执行的SQL是:
SELECT COUNT(*) FROM `user_request_wallet` LEFT JOIN `mainRequest` WHERE ((`lead_developer`=7) AND (`answer_tocall`='accepted')) OR (`answer_tocall`='putonhold')