sql 从任何列表中选择拆分字符串

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 从任何列表中选择拆分字符串相关的知识,希望对你有一定的参考价值。

with json_names as
(select distinct split_part(account_name, '.', 1) from reports_json_orders)
, good_domains as 
(
	select shop_domain, account
	from reports_account_integration 
	where split_part(shop_domain, '.', 1) like any (array[select * from json_names])
)
select A.brand_name, B.* from reports_account A join good_domains B on A.primary_key = B.account

-- OR --
select * from table where value  like any (array['%foo%', '%bar%', '%baz%']);
select * from table where value ilike any (array['%foo%', '%bar%', '%baz%']);

-- OR --
select * from table where lower(value) similar to '%(foo|bar|baz)%';
select * from table where value ~* 'foo|bar|baz';
--The ~* is for a case insensitive match, ~ is case sensitive.

以上是关于sql 从任何列表中选择拆分字符串的主要内容,如果未能解决你的问题,请参考以下文章