设置p1为参数,其数据字典值为Day,Year,Month,希望选择时间维度不同,柱状图按不同时间维度展示图表,我写的柱状图的SQL为: select ${p1}, sum(ElectricValue) as '耗电量' from RES_Energydata where 1=1 ${if(p1='Day', "and RES_Energydata.[Year]= convert(int,datename(year,getdate())) and RES_Energydata.[Month] = 11", "")} ${if(p1='Month',"and RES_Energydata.[Year]= convert(int,datename(year,getdate()))", "")} ${if(p1='Yaer',"","")} group by ${p1} order by ${p1} 设置柱状图数据为: 选择Day的时候正常,但是选择Month,Year都不能获取到分类数据,而且Yaer根本不展示数据,请教一下怎么解决 |