I have a string comparison that I would like to do against a short list of constant strings.

at the moment I am using the syntax

SELECT id FROM t1 WHERE name IN('s1', 's2', 's3', ...);

However, this limits me to exact matches and I'd like to move to a caparison expersion that lets me match names that contain any of the list. The MySQL docs state that 'IN()' is an alias to '= ANY()' however when I substitute' = ANY' for IN I get a parse error. What I'd like to do is write something like (although I figure there may be a better way to do the comparison that I am not thinking of):

SELECT id FROM t1 WHERE name LIKE ANY('%s1%', '%s2%', '%s3%', ...);

Does anyone know a way to do this?

Thanks,

->Ben

Reply via email to