文章詳情頁
mysql - yii2 多表聯查 where條件里 A表字段=B表字段怎么表示
瀏覽:87日期: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. android - 用textview顯示html時如何寫imagegetter獲取網絡圖片2. css3 - css怎么實現圖片環繞的效果3. 在mac下出現了兩個docker環境4. javascript - 原生canvas中如何獲取到觸摸事件的canvas內坐標?5. css - 定位為absolute的父元素中的子元素 如何設置在父元素的下面?6. JavaScript事件7. 注冊賬戶文字不能左右分離8. javascript - jquery hide()方法無效9. html - vue項目中用到了elementUI問題10. 網頁爬蟲 - 用Python3的requests庫模擬登陸Bilibili總是提示驗證碼錯誤怎么辦?
排行榜
