文章詳情頁
mysql - yii2 多表聯查 where條件里 A表字段=B表字段怎么表示
瀏覽:68日期:2022-06-18 10:03:42
問題描述
yii2 多表聯查 where條件里 A表字段=B表字段怎么表示?
$res =self::find()->select([’a.id’,’a.name’]) ->join(’LEFT JOIN’,’b’,’b.qid=a.id’) ->join(’LEFT JOIN’,’c’,’c.uid=b.uid’) ->where([’a.state’=>0,’b.state’=>0,’c.state’=>0,’c.uid’=>123456]) ->asArray()->all();
想在where條件里加上c.type=b.type怎么加???
問題解答
回答1:$query->andWhere(new yiidbExpression(’c.type = b.type’))
相關文章:
1. vim里的高亮javascript的javascript.vim 已經放到syntax里了,但是不行。2. angular.js - ng-file-upload 如何實現多圖片上傳3. android - xml的drawable作背景,是否會產生錯誤4. python - pip install出現下面圖中的報錯 什么原因?5. 我何時應該在Java中使用JFrame.add(component)和JFrame.getContentPane()。add(component)6. angular.js - angularJs ngRoute怎么在路由傳遞空字符串及用ng-switch取得7. 輸入地址報以下截圖錯誤,怎么辦?8. node.js - node中MYSQL的異步問題9. javascript - 求助一個關于indexedDB的問題10. javascript - ie11以下單擊打開不了file,雙擊可以。求解?
排行榜
