萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mssql數據庫 >> Sql Server統計表中某年某月某個值有多少?

Sql Server統計表中某年某月某個值有多少?

   比如:統計表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統計表中某年某月某個值有多少? 三聯

  查詢後的結果:

copyright © 萬盛學電腦網 all rights reserved