简体   繁体   English

如何从比较表达式中提取比较器的指定字段

[英]How to extract a specified field of comparator from a comparison expression

I have a SQL like " where age = 1 and name = 'xxx' and ds >= '2021-11-11', how to extact the comparison of field 'ds', like ds > '2021-11-11'?我有一个 SQL 像“其中年龄 = 1 和名称 = 'xxx' 和 ds >= '2021-11-11',如何提取字段 'ds' 的比较,如 ds > '2021-11-11'?

even more, i need to analyze complex sql like: where age = 2 and ( ds = '2021-11-11' or name = 'xxx' ) or ds = '2021-12-12'.更重要的是,我需要分析复杂的 sql,例如:其中年龄 = 2 和(ds = '2021-11-11' 或 name = 'xxx')或 ds = '2021-12-12'。

is there a algorithm or code help me?有算法或代码帮助我吗?

Does something like this work for you?这样的事情对你有用吗?

select a,b,..., 
   iif(ds > '2021-11-11', 
      'ds is greater', 
       iif(ds = '2021-11-11', 'ds is equal', 'ds is less')) as 'ds_compare'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM