I am performing a soundex query on a table of users. A subquery of users is provided as a comma separated list of strings.
I want to do something akin to the following, but I cannot find the write syntax to make this work.
select * from ((Select soundex(concat(fname, lname)) t, * from users)
Union
(Select soundex(fname) t, * from users)
Union
(Select soundex(lname) t, * from users)) xusers
where t in (select soundex([column]) from ('Name 1', 'Name 2', 'Name 3', 'Name N-1', 'Name N'))
Later I plan to optimize this query by having a table with the soundex values mapped to column id's, however, I'm not sure now I can reference an anonymous column when my subquery is a comma delimited list? How do I add an alias, or how can convert this list to a list of soundex values to perform comparisons with?