文章详情页
mysql - yii2 多表联查 where条件里 A表字段=B表字段怎么表示
浏览:134日期: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. angular.js - 如何控制ngrepeat输出的个数2. html - vue项目中用到了elementUI问题3. ionic 项目 ionic build android -release 打包时报错4. javascript - 在使用 vue.js element ui的时候 怎么样保留table翻页后check的值?5. mac里的docker如何命令行开启呢?6. mysql_replication - mysql读写分离时如果单台写库也无法满足性能怎么解决7. python3.x - python3.5.2安装时make报错求助8. javascript - vue组件通过eventBus通信时,报错a.$on is not a function9. python - 如何用pandas处理分钟数据变成小时线?10. javascript - 求一款靠谱点的移动端图片查看器插件,老司机速进!
排行榜

网公网安备