Iain Fifer Iain Fifer - 1 year ago 96
SQL Question

MySQL: Select row where column contains element from list

I am trying to select all rows from a table where column contains an element from a list:
Something like

Select * from `table` where `column` (contains anything from {£,$,%,^,&,...,/})

This is basically an illegal character check.

Can anyone help?


Answer Source

For MySQL you may use REGEXP or RLIKE to check specific column for pattern matching. In your case following example might work:

SELECT * FROM `table` WHERE `column` REGEXP '[\£\$\%\^\&]';