I need to do a mapping that is taxing my handle on SQL.
I need to know if a substring exists in a CSV contained in a table cell. If so, I need it to return the string 'true' else 'false'
This query works in that it returns the CSV I need to check:
select table.value from table where table.user_id = 1 and table.keyname = 'email_list'
I was attempting to include that SQL inside a conditional like this:
IF ( (select table.value from table where table.user_id = 1 and
table.keyname = 'email_list') LIKE '%substring%') THEN 'true' ELSE 'false'
But no luck so far. This is actually one component of a much bigger query mapping different elements from one table to another so I really need it to just return a string of 'true' or 'false' for it to work appropriately.
Table structure looks something like this:
User KEYNAME value (in the form of CSV)
1 email_list [email protected], [email protected]
2 email_list
3 email_list [email protected]
4 email_list [email protected], [email protected], [email protected]