赞
踩
-- 示例
SELECT prod_name FROM products WHERE prod_name REGEXP ‘col1|col2’
-- 列转行
select group_concat(testcol) from tableA;
-- 完整版
SELECT prod_name FROM products WHERE prod_name REGEXP (select
replace(group_concat(testcol),'\'','|')
from tableA);
-- 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]%';
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。