qb.leftJoin('info_student', 'grouping_class_student.studentId', 'info_student.id');
qb.leftJoin('grouping_class', 'grouping_class_student.classId', 'grouping_class.id');
qb.leftJoin('exam_score', 'grouping_class_student.studentId', 'exam_score.studentId');
qb.where('grouping_class_student.planId', groupingId);
qb.where(function() {
this.where(function() {
this.where('exam_score.planId', '=', examId);
}).orWhere(function() {
this.whereNull('exam_score.planId');
});
});

多个表左联,要返回全部的结果,解决不能用where的问题

qb.where(function() {
this.where(function() {
this.where('exam_score.planId', '=', examId);
}).orWhere(function() {
this.whereNull('exam_score.planId');
});
}); 这一部份是关键点

最新文章

  1. nginx服务器http重定向到https的正确写法
  2. [转]eclipse重新编译
  3. java中的权限修饰符的理解
  4. BZOJ 3884 欧拉定理 无穷幂取模
  5. Webform(Linq增删改查)
  6. Html5的一些引擎使用感触
  7. 又一个绝对棒的对话框插件fancybox v1.3.4
  8. 我要阻止做java开发的男朋友去创业型公司工作吗?
  9. (Unity)Unity自定义Debug日志文件,利用VS生成Dll文件并使用Dotfuscated进展混淆,避免被反编译
  10. 文件控制列表命令setfacl和getfacl的使用
  11. windows7下硬盘安装ubuntu14.04
  12. java异常练习2
  13. Bootstrap-风格的下拉按框:Bootstrap Select
  14. [UIKit学习]01.关于UIView,frame,bounds,center
  15. 大数据学习系列之四 ----- Hadoop+Hive环境搭建图文详解(单机)
  16. NPOI 2.0 教程
  17. 插件占坑,四大组件动态注册前奏(二) 系统Service的启动流程
  18. pytest进阶之conftest.py
  19. POJ 3140 Contestants Division 【树形DP】
  20. JavaScript防篡改对象

热门文章

  1. BootStrap table动态增删改表格内数据
  2. Maintaining ICM Parameters for Using SSL for As JAVA
  3. PID控制器介绍
  4. Autofac使用代码方式进行组件注册【不需要依赖】
  5. 4.Linux开机设置项
  6. Python 3.7 安装Twisted
  7. Visual Studio 2017 密匙
  8. open()函数 linux中open函数使用
  9. UE4 Creating 3D Widget Interaction
  10. Web开发敏捷之道应用Rails 进行Web开发(原书第4版)遇到的问题