I have table in SQL Teradata:
x
client | description
--------------------|-----------
John Simon |arg John Simon
Larry Foe |Larry Foe por
Judy Gap |payment 11
And I need to find only these clients which has their name (from column “client”) + “arg” or “por” in column “descpition” nevermind whether before or after name. So using above example I need to display only John Simon and Larry Fore, because they have their name in column “description + “arg” or “por” nevermind whether before or after name.
How can I do that?
Advertisement
Answer
One method is:
where description like '%' || client || '%' and
(' ' || description || ' ' like '% por %' or
' ' || description || ' ' like '% org %'
)
The delimiters in the second part are just to avoid matches for a name like “Portland”.