文章詳情頁
mysql - yii2 多表聯查 where條件里 A表字段=B表字段怎么表示
瀏覽:66日期: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. javascript - ionic1的插件如何遷移到ionic2的項目中2. java - 如何在Fragment中調用Activity的onNewIntent?3. javascript - h5上的手機號默認沒有識別4. mysql里的大表用mycat做水平拆分,是不是要先手動分好,再配置mycat5. css - 關于input標簽disabled問題6. python - 獲取到的數據生成新的mysql表7. 怎么用css截取字符?8. window下mysql中文亂碼怎么解決??9. javascript - jquery hide()方法無效10. python的文件讀寫問題?
排行榜
