永洪社区

标题: 请问数据集里怎么动态拼接筛选条件 [打印本页]

作者: yhdata_3KfWnIs4    时间: 2022-7-4 14:39
标题: 请问数据集里怎么动态拼接筛选条件
问题遇到的现象和发生背景

使用sql语句动态拼接where条件,条件中包含 or

问题相关代码,请勿粘贴截图

select * from dict where 单位编码 IN ('10206') and ver='510' and substr(日期, 1, 7) between '2016-01' and '2035-12' and formula_id='首发集团合并快报' OR ( 单位编码 IN ('10210') and ver='510' and substr(日期, 1, 7) between '2016-01' and '2035-12' and formula_id='首发集团合并快报')

我想要达到的结果

where 后面的筛选条件需要通过sql查询数据表获得,怎么将SQL拼接到where 后面



作者: yhdata_lyaa    时间: 2022-7-4 15:25
网上查一下SQL怎么写呢




欢迎光临 永洪社区 (https://club.yonghongtech.com/) Powered by Discuz! X3.4