orcle 按年度 月度 汇总

select mcorhr,dtype,
sum(h01) as sums,

datepart(year,(select left(mdate,4)+'-'+substring(mdate,5,2)+'-'+right(mdate,2))) as y,
datepart(month,(select left(mdate,4)+'-'+substring(mdate,5,2)+'-'+right(mdate,2))) as m
from "EMSHIS"."CBPM"."CBPM_LINE_LIMIT"
where 0=0

group by mdate,mcorhr,dtype

posted on 2016-07-10 20:39  静以修身!  阅读(209)  评论(0编辑  收藏  举报

导航