DbQueryUserMiniDao_queryUserByEdu.sql 1.3 KB

123456789101112131415161718192021222324252627
  1. select count(baseuu.realname) as total,
  2. count(uu2.id)as unknownCount,
  3. count(uu3.id)as wuxueliCount,
  4. count(uu4.id)as xiaoxueCount,
  5. count(uu5.id)as chuzhongCount,
  6. count(uu6.id)as gaozhongCount,
  7. count(uu7.id)as dazhuanCount,
  8. count(uu8.id)as benkeCount,
  9. count(uu9.id)as shuoshiCount,
  10. count(uu10.id)as boshiCount,
  11. dp.glcname as departname
  12. from t_bus_user_personnel pers
  13. LEFT JOIN t_s_base_user baseuu on baseuu.id = pers.userid
  14. left join t_s_user_org uorg on uorg.user_id = pers.userid and uorg.ifpluralism = '0'
  15. left join t_s_user uu on baseuu.id = uu.id
  16. left join t_s_depart dp on dp.ID = uorg.org_id
  17. left join t_s_user uu2 on baseuu.id = uu2.id and uu2.education is null
  18. left join t_s_user uu3 on baseuu.id = uu3.id and uu3.education = '0'
  19. left join t_s_user uu4 on baseuu.id = uu4.id and uu4.education = '1'
  20. left join t_s_user uu5 on baseuu.id = uu5.id and uu5.education = '2'
  21. left join t_s_user uu6 on baseuu.id = uu6.id and uu6.education = '3'
  22. left join t_s_user uu7 on baseuu.id = uu7.id and uu7.education = '4'
  23. left join t_s_user uu8 on baseuu.id = uu8.id and uu8.education = '5'
  24. left join t_s_user uu9 on baseuu.id = uu9.id and uu9.education = '6'
  25. left join t_s_user uu10 on baseuu.id = uu10.id and uu10.education = '7'
  26. where pers.leave_date is null and baseuu.delete_flag = '0' and dp.glcname is not null
  27. GROUP BY dp.glcname