|
此语句主要用于统计每个部门,每个月份(可以自行更改),自选年度,根据用户需求进行更改语句 ${ if(param('nd')!= null || param('nd')!=''){ return "select a.ZLBM 部门, isnull(a.[1] , 0) 一月, isnull(a.[2] , 0) 二月, isnull(a.[3] , 0) 三月, isnull(a.[4] , 0) 四月, isnull(a.[5] , 0) 五月, isnull(a.[6] , 0) 六月, isnull(a.[7] , 0) 七月, isnull(a.[8] , 0) 八月, isnull(a.[9] , 0) 九月, isnull(a.[10] , 0)十月, isnull(a.[11] , 0)十一月, isnull(a.[12] , 0)十二月 from (select yuefen,zlbm,nd,count(1) cc from d_file4 where status=0 and zlbm is not null and zlbm <>\'\' and nd = :nd group by zlbm,yuefen,nd) as t pivot ( sum(cc) for yuefen in([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]) ) a" } } 参数设置 参数名:nd 数据类型:string 默认值:0 以下为效果图
|