字段like多个条件(or关系)简写

字段 like ‘匹配串1’or 字段 like ‘匹配串2’or ... 有如下简写方式

oracle:

select  * from tablex where REGEXP_LIKE(字段名, '(匹配串1|匹配串2|...)') ;//全模糊匹配

select  * from tablex where REGEXP_LIKE(字段名, '^(匹配串1|匹配串2|...)') ";//右模糊匹配

select  * from tablex where REGEXP_LIKE(字段名, '(匹配串1|匹配串2|...)$') ";//左模糊匹配

SqlServer

select  * from tablex where f1 like '%[匹配串1|匹配串2|匹配串3]%'

猜你喜欢

转载自www.cnblogs.com/d0-0b/p/10670302.html
今日推荐