select a.*,b.wpj from(select a.*,b.bmy from(select a.*,b.yb from (select a.*,b.my from ( select loginname ,realname from sys_user where unitid='0204')a left join (select LOGINANME,count(1) my from slj_callback where sat= 3 --manyi ${if(len(ks) == 0,""," AND substr(backtime,1,15)>='"+ks+"'")} ${if(len(js) == 0,""," AND substr(backtime,1,15)<='"+js+"'")} group by LOGINANME) b on a.loginname =b.LOGINANME ) a left join (select loginanme,count(1) yb from slj_callback where sat = 2 --yiban ${if(len(ks) == 0,""," AND substr(backtime,1,15)>='"+ks+"'")} ${if(len(js) == 0,""," AND substr(backtime,1,15)<='"+js+"'")} group by loginanme) b on a.loginname = b.loginanme)a left join (select loginanme,count(1) bmy from slj_callback where sat = 1 --bumanyi ${if(len(ks) == 0,""," AND substr(backtime,1,15)>='"+ks+"'")} ${if(len(js) == 0,""," AND substr(backtime,1,15)<='"+js+"'")} group by loginanme) b on a.loginname = b.loginanme) a left join (select loginanme,count(1) wpj from slj_callback where sat = 0 --weipingjia ${if(len(ks) == 0,""," AND substr(backtime,1,15)>='"+ks+"'")} ${if(len(js) == 0,""," AND substr(backtime,1,15)<='"+js+"'")} group by loginanme) b on a.loginname = b.loginanme 默认条件下,查询出来的空值判断设置成0