原文发布时间为:2010-09-06 —— 来源于本人的百度文章 [由搬家工具导入]

《转》http://www.cnblogs.com/ruanzuzhang/archive/2009/02/22/1395789.html在同一个sql语句中写不同条件的Count数量 类似select count(1),count(2),count(3) from 表 每列都有不同条件的 count组成

 其实有count很难实现

可以用sum 去实现它

例子如下

  select xy, sum(case when jw_cljgh=1 then 1 else 0 end) as 留级,sum(case when jw_cljgh=2 then 1 else 0 end) as 复学 from xjgl,bjsjk where xjgl.bh=bjsjk.bh group by xy


类似

                       留级     复学

医学院              104     4

计算机学院          5       35

相关文章:

  • 2021-12-29
  • 2021-12-10
  • 2021-10-29
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2021-11-04
  • 2021-03-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-10
  • 2022-12-23
  • 2022-02-20
  • 2022-12-23
  • 2021-10-11
相关资源
相似解决方案