这与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
答案 0 :(得分:3)
select *
from people
where name like any (
select concat(last_name, ', ', first_name, '%')
from other_people
)