Reputation: 665
I'm trying to find a way to run a query which selects where the first two characters of an eight character string are Not numeric.
I've found a way to select if the entire string is numeric:
SELECT str FROM tbl
WHERE str REGEXP('(^[0-9]+$)');
So from my limited knowledge of regex I'm guessing that I'll need to use something like:
SELECT str FROM tbl
WHERE str REGEXP('(^[A-Z]+$)');
(I'm OK to use capitals for this as thats how the codes are stored)
I just don't know how to apply this test to just the first 2 characters of the string instead of the entire string?
Upvotes: 1
Views: 39