通过参数给出不同sql语句怎么写

a.wfxw in
${if(len(wfxwmc) == 0,"(select wfxw from vio_dim_codewfdm)",
"AND select wfxw from vio_dim_codewfxw where (wflwmc = '" + wfxwmc + "')")}
如果wfxwmc长度为0,那么执行select wfxw from vio_dim_codewfdm;
如果wfxwmc长度不为0,执行select wfxw from vio_dim_codewfxw where wflxmc='${wfxwmc}'这个sql语句
FineReport heiqizero 发布于 2017-5-26 14:09
悬赏:2 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共5回答
最佳回答
0
cherishdqy发布于2017-5-26 14:09(编辑于 2023-9-6 09:34)
555
最佳回答
0
cherishdqy发布于2017-5-26 14:15(编辑于 2023-9-6 09:34)
555
  •  heiqizero heiqizero(提问者)

    select a.wfrq,sum(a.wfsl) from vio_fact_wfjl a
    where 1=1 and a.wfrq>=\'${kssj}\' and a.wfrq<=\'${jssj}\' and
    a.wfxw in
    ${if(len(wfxwmc) == 0,\"select wfxw from vio_dim_codewfdm\",\"select wfxw from vio_dim_codewfxw where wflxmc=\'\"+wfxwmc+\"\'\")
    and a.hpzl in (select hpzl from vio_dim_hpzl where dmsm1=\'${hphmmc}\')
    group by a.wfrq    结果报null
    回复
    2017-05-26 14:25 
  •  heiqizero heiqizero(提问者)

    select a.wfrq,sum(a.wfsl) from vio_fact_wfjl a
    where 1=1 and a.wfrq>=\'${kssj}\' and a.wfrq<=\'${jssj}\' and  
    a.wfxw in ${if(len(wfxwmc) == 0,\"select wfxw from vio_dim_codewfdm\",\"select wfxw from vio_dim_codewfxw where wflxmc=\'\"+wfxwmc+\"\'\")}
    and a.hpzl in (select hpzl from vio_dim_hpzl where dmsm1=\'${hphmmc}\')
    group by a.wfrq

    报缺失表达式
    回复
    2017-05-26 14:31 
  •  heiqizero heiqizero(提问者)

    谢啦。。。。
    回复
    2017-05-26 14:40 
最佳回答
0
heiqizero发布于2017-5-26 14:25(编辑于 2023-9-6 09:34)
555
最佳回答
0
heiqizero发布于2017-5-26 14:31(编辑于 2023-9-6 09:34)
555
最佳回答
0
heiqizero发布于2017-5-26 14:40(编辑于 2023-9-6 09:34)
555
  • 0关注人数
  • 449浏览人数
  • 最后回答于:2017-5-26 14:40
    活动推荐 更多
    热门课程 更多
    返回顶部