PostgreSQL通配符LIKE,用于Subquery返回的任何单词列表

时间:2016-09-01 14:21:53

标签: sql postgresql

这与PostgreSQL wildcard LIKE for any of a list of words非常相似,除了不想在静态单词列表上匹配之外,我想匹配子查询返回的单词列表。

这样的事情:

SELECT *
FROM people
WHERE name ~* (SELECT concat(last_name, ', ', first_name) 
               FROM other_people) + wildcard in this direction

1 个答案:

答案 0 :(得分:3)

select *
from people
where name like any (
    select concat(last_name, ', ', first_name, '%')
    from other_people
)