各位大神好 我现在有个需求是根据选择的省市县去合计两个数值,如果只选择省这个参数就按照省为单位合计,选择省和市就按照省+市来合计,省市县都选择的话,合计维度精确到县。代码中在where语句里面做了多选的限制,用的in 但是关于市和县这里做限制的时候代码写上就报错。。。求大神帮忙看看问题所在。。谢谢
代码如下:
select ${if(len(省)=0,"","sheng")}
${if(len(市)=0,"",",shi")}
${if(len(县)=0,"",",xian")},
sum(hryongliang),
sum(mzyl) from(select (select enum_item.showvalue from ctp_enum_item enum_item where enum_item.id = formmain_3840.field0001) sheng, field0002 shi,field0003 xian,field0008 mzyl,field0041 hryongliang from formmain_3840)
where 1=1 and sheng in('${省}')
${if(len(市)=0,"","and shi in ('${市}')")}-------------------------------------------------这两行写上就报错
${if(len(县)=0,"","and xian in ('${县}')")}-----------------------------------------------这两行写上就报错
group by
${if(len(省)=0,"","sheng")}
${if(len(市)=0,"",",shi")}
${if(len(县)=0,"",",xian")}