欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Sql Server统计表中某年某月某个值有多少?

程序员文章站 2022-04-01 12:29:23
...

比如:统计表AA中YWLX列在某年某月每种类型各有多少? select year(AA_YWRQ) as YEARS, month(AA_YWRQ) AS Months ,AA_YWLX,count(AA_YWLX) as Number from AA group by year(AA_YWRQ), month(AA_YWRQ),AA_YWLX 表中数据: 查询后的结果:

  比如:统计表AA中YWLX列在某年某月每种类型各有多少?

  select

  year(AA_YWRQ) as YEARS,

  month(AA_YWRQ) AS Months ,AA_YWLX,count(AA_YWLX) as Number

  from AA

  group by year(AA_YWRQ),

  month(AA_YWRQ),AA_YWLX

  表中数据:

Sql Server统计表中某年某月某个值有多少?

  查询后的结果:

Sql Server统计表中某年某月某个值有多少?