Reputation: 1476
This is very much like PostgreSQL wildcard LIKE for any of a list of words, except instead of wanting to match on a static list of words, I want to match on a list of words returned by a subquery.
Something like this:
SELECT *
FROM people
WHERE name ~* (SELECT concat(last_name, ', ', first_name)
FROM other_people) + wildcard in this direction
Upvotes: 3
Views: 1420
Reputation: 125544
select *
from people
where name like any (
select concat(last_name, ', ', first_name, '%')
from other_people
)
Upvotes: 4