Craig Stadler wrote:
Im trying to write a like query
select * from table1 where column1 like 'abc[0-9]%'
(I realize this syntax isnt correct)
I want to include any chars from 0-9 in that spot...
Does anyone know how to do this?
Standard SQL expressions used with the LIKE predicate have only two
wildcards: '_' matches a single character (like '.' in UNIX-style
regular expressions), and '%' matches any sequence of characters (like
'.*' in UNIX-style regular expressions)
MySQL extends SQL with a predicate that matches more complex regular
expressions, including many of the wildcards familiar to UNIX users.
In your example, you should be able to get the result you want with the
following query:
select * from table1 where column1 REGEXP '^abc[0-9]'
See also:
http://dev.mysql.com/doc/mysql/en/Pattern_matching.html http://dev.mysql.com/doc/mysql/en/Regexp.html
Regards,
Bill K.