数据集参数

MYSQL数据库,展示数据,根据日期类型,选择不同的日期时间段,不起作用;

where 1=1  ${if(typedate=="0"," and left(d.end_date,10) >='"+ P1  +"'"+" and left(d.end_date,10)<='"+ P2+"'",  if(typedate=="1"," and left(a.submit_date,10)>='"+  P3+"'"+" and left(a.submit_date,10)<='"+  P4+"'"))}

写法如上所示,typedate=="0"的时候是可以展示的,typedate=="1"一直转圈没法显示。?

FineReport SQL 其他问题 liuyan123 发布于 2023-2-1 16:35
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共6回答
最佳回答
0
CD20160914Lv8专家互助
发布于2023-2-1 16:38

where 1=1  

${if(typedate="0"," and left(d.end_date,10) >='"+ P1  +"'"+" and left(d.end_date,10)<='"+ P2+"'",  

if(typedate="1"," and left(a.submit_date,10)>='"+ P3+"'"+" and left(a.submit_date,10)<='"+  P4+"'",""))}

最佳回答
0
luojian0323Lv7资深互助
发布于2023-2-1 16:36(编辑于 2023-2-1 16:37)

看下是不是数据类型等号两边不匹配

把参数值带入,直接执行后半句过滤条件试试。

最佳回答
0
胖哒哒君Lv5见习互助
发布于2023-2-1 16:41

where 1=1  

${if(typedate="0"," and left(d.end_date,10) >='"+ P1  +"' and left(d.end_date,10)<='"+ P2+"'",  

if(typedate="1"," and left(a.submit_date,10)>='"+  P3 +"' and left(a.submit_date,10)<='"+  P4+"'",""))}

最佳回答
0
其实我是宁采臣Lv4见习互助
发布于2023-2-1 17:16

第二个if,少了一段

最佳回答
0
ln2481Lv5初级互助
发布于2023-2-1 17:30

第二个IF缺少else的情况

最佳回答
0
ln2481Lv5初级互助
发布于2023-2-1 17:31

第二个IF缺少else的情况

where 1=1  

${if(typedate=="0"," and left(d.end_date,10) >='"+ P1  +"'"+" and left(d.end_date,10)<='"+ P2+"'",  

       if(typedate=="1"," and left(a.submit_date,10)>='"+  P3+"'"+" and left(a.submit_date,10)<='"+  P4+"'","")

 )}

  • 4关注人数
  • 545浏览人数
  • 最后回答于:2023-2-1 17:31
    请选择关闭问题的原因
    确定 取消
    返回顶部