提供sqlserver参考:select col_name,sum(case when datediff(d,col_date,getdate())=0 then col_int else 0 end) as [col_DD(日)],sum(case when datediff(m,col_date,getdate())=0 then col_int else 0 end) as [col_MM(当月)],sum(case when datediff(yy,col_date,getdate())=0 then col_int else 0 end) as [col_YY(当年)] from Tbl_1 group by col_name