0
|
snrtuemcLv8专家互助发布于2022-11-23 14:05(编辑于 2022-11-23 14:24)
|
select * from 表 where 1=1 ${switch(参数名,"A"," and (a=1 or a=2 or a=3)","B","and (a=4 or a=5 or a=6)")} =========== select sum(psmng0)as 产量 ,sum(psmng2)as 累计产量 ,sum(pval)as 产值 ,sum(pval2)as 累计产值 from zyw_sdtt0040 where 1 = 1 ${switch(cpfl,"折剪产品"," and (bezei in('数控折剪','普通折剪'))", "成套线项目组","and (bezei in ('自动化','重型','折边'))", "钣金事业部","and (bezei in ('冲床','普通折剪','数控折剪'))", "平板产品","and (bezei in ('激光','自动化','重型','冲床','折边','普通折剪','数控折剪'))", "总计","", "冲床","and (bezei = '冲床')", "创科源","and (bezei = '创科源')", "卷板","and (bezei = '卷板')", "压力机","and (bezei = '压力机')", "折边","and (bezei = '折边')", "机器人","and (bezei = '机器人')", "激光","and (bezei = '激光')") }
|
-
DerekWestBrook(提问者)
- select sum(psmng0)as 产量 ,sum(psmng2)as 累计产量 ,sum(pval)as 产值 ,sum(pval2)as 累计产值 from
zyw_sdtt0040
where 1 = 1
${switch(cpfl,\"折剪产品\",\" and (bezei in(\'数控折剪\',\'普通折剪\'))\",
\"成套线项目组\",\"and (bezei in (\'自动化\',\'重型\',\'折边\'))\",
\"钣金事业部\",\"and (bezei in (\'冲床\',\'普通折剪\',\'数控折剪\'))\"),
\"平板产品\",\"and (bezei in (\'激光\',\'自动化\',\'重型\',\'冲床\',\'折边\',\'普通折剪\',\'数控折剪\'))\"),
\"总计\",\" \"),
\"冲床\",\"and (bezei = \'冲床\')\"),
\"创科源\",\"and (bezei = \'创科源\')\"),
\"卷板\",\"and (bezei = \'卷板\')\"),
\"压力机\",\"and (bezei = \'压力机\')\"),
\"折边\",\"and (bezei = \'折边\')\"),
\"机器人\",\"and (bezei = \'机器人\')\"),
\"激光\",\"and (bezei = \'激光\')\")
}
大佬我这样写有问题吗,为什么取数结果预览没有让我填cpfl的值,直接显示了一条结果呢
-
snrtuemc 回复 DerekWestBrook(提问者)
- 最后对了几个括号,我给删除了,看修改答案
-
DerekWestBrook(提问者) 回复 snrtuemc
- 那大佬,后面那个问题 如何将参数值写入单元格里呢
-
snrtuemc 回复 DerekWestBrook(提问者)
- 直接单元格=$参数名
-
DerekWestBrook(提问者) 回复 snrtuemc
- 好用!谢谢大佬解答
|
|