A quick Google revealed MySL supports some POSIX regex:
Code: Select all
SELECT 'Monty!' REGEXP 'm%y%%';Here is a demo record:
pkid, fkid, name, age, address, states:
1, 2, "Alex", 29, "123 Test Ave.", "Texas, Alabama, Utah"
The query would look something like:
[sql]SELECT * FROM TABLE WHERE age < 30 REGEX '%$state'[/sql]
Where $state would be a single state...
Anyone mind showing me how this might be done using regex and a single field?
I know I could introduce another table which associated multiple states with a single record but I need to use regex for the sake of simplicity.