select *,'月' as tjlb1,count(distinct substring(dm,1,4)) as 数 into #sl from BK (nolock) where substring(cyrq,1,7)='${tjrq}'+'-'+'${tjsj}' union select *,'季' as tjlb1,count(distinct substring(dm,1,4)) as 数 from BK (nolock) where case when substring(cyrq,6,2) in ('01','02','03') then substring(cyrq,1,4)+'一季度' when substring(cyrq,6,2) in ('04','05','06') then substring(cyrq,1,4)+'二季度' when substring(cyrq,6,2) in ('07','08','09') then substring(cyrq,1,4)+'三季度' when substring(cyrq,6,2) in ('10','11','12') then substring(cyrq,1,4)+'四季度' end ='${tjrq}'+'${tjsj}' union select *,'年' as tjlb1,count(distinct substring(dm,1,4)) as 数 from BK (nolock) where substring(cyrq,1,4) ='${tjrq}' group by czrq select * from #sl (nolock) where tjlb1='${tjlb}' |
最佳回答 |
||||
0
|
|