yhdata_QifoXPD3玄铁二
5 小时前 发布在问答
关于根据一个参数条件来判断是否在sql中有另外的参数
比如我想设置一个参数 type ,这个参数有值 1 或者 2
当这个参数选择1时,在sql中查询条件有start_time这个参数
限定条件:start_time始终不为空
sql执行时为下面内容
select * from table
where 1=1
start_time = ?{start_time}

当参数选择2时 在sql中查询条件没有start_time这个参数
sql执行时为下面内容
select * from table
where 1=1



13
1
精彩评论1
yhdata_lyaa
发表于 4 小时前 显示全部楼层

https://www.yonghongtech.com/hel ... paramindataset.html
试试?{@a},内嵌参数形式
这种内嵌的参数将被直接在SQL Statement中替换为参数值
写脚本,比如当type==1,param['a']='start_time = ?{start_time}'
sql再调用
select * from table
where 1=1
?{a}
回复

使用道具 2#

高级模式
您需要登录后才可以回帖 登录 | 免费注册

  • 官方微信

    欢迎关注永洪服务号!收费为0,价值无限

    扫码关注
  • 新浪微博

    让每位用户轻松挖掘数据价值!

    访问新浪微博
  • 智能客服
100W

用户等你来哦

Copyright   ©2012-2025  北京永洪商智科技有限公司  (京ICP备12050607) 京公网安备110110802011451号 |《永洪社区协议》
返回顶部