帆软填报报表,sql语句求助

大佬,求助,开发驱动因素是多选项,一般为:0,1或1或1,3  但是我现在设置的是单选,所以会报错,sql不太行,如果改成多选

select 

lastname 申请人,

case when kfqdys = 0 then '新产品开发'

when kfqdys = 1 then '质量提升'

when kfqdys = 2 then '成本优化'

else '提升交付能力'

end as 开发驱动因素

from excel1

image.png

image.png

image.png

image.pngimage.png

SQL 帆软用户3bPoc34yfg 发布于 2025-5-23 11:14 (编辑于 2025-5-26 13:45)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共4回答
最佳回答
0
CD20160914Lv8专家互助
发布于2025-5-23 11:16(编辑于 2025-5-23 11:25)

你这个单选不会报错。多选才会报错的呀。

现在你的这个语句不会报错,你没有传入参数

select 

lastname 申请人,

case when kfqdys = '0' then '新产品开发'

when kfqdys = '1' then '质量提升'

when kfqdys = '2' then '成本优化'

else '提升交付能力'

end as 开发驱动因素

from excel1

where 1=1

and kfqdys in('${cs}')

设置复选框的分隔符号为,

复选框的实际值用数字。显示值 用你上面判断后的

image.png

image.png

最佳回答
0
Z4u3z1Lv6专家互助
发布于2025-5-23 11:16
最佳回答
0
用户k6280494Lv6专家互助
发布于2025-5-23 11:17

SELECT * from (

select

lastname 申请人,

case when kfqdys =0 then'新产品开发'

when kfqdys = 1 then '质里提升'

when kfqdys =2 then '成本优化'

else'提升交付能力'

end as 开发驱动因素

from excel1

) a

WHERE 开发驱动因素 in (1,2)

最佳回答
0
用户p7827986Lv2见习互助
发布于2025-5-23 11:37

with tab as (

select 

lastname  申请人,

case when kfqdys = 0 then '新产品开发'

     when kfqdys = 1 then '质量提升'

     when kfqdys = 2 then '成本优化'

     else '提升交付能力' end as 开发驱动因素

     

from excel1

select  

  申请人,

  开发驱动因素 

from tab 

  where 开发驱动因素 in '${参数名称}'

  • 4关注人数
  • 83浏览人数
  • 最后回答于:2025-5-26 13:45
    请选择关闭问题的原因
    确定 取消
    返回顶部