Posted 26 November 2012 - 09:54 PM
I need to find valid records as part of a database cleanup script.
What I need is a regular expression that will match, for a single column:
records containing BOTH numbers AND letters (or any other character).
records containing ONLY numbers (including decimals)
Invalid records are those which contain ONLY letters and I do not want these returned, or NULL for the column.
Anybody good with regex?
Posted 26 November 2012 - 11:22 PM
Posted 27 November 2012 - 01:59 AM
SELECT model FROM products WHERE model != '' AND model != '0' AND (model REGEXP '[0-9][a-z]' OR model REGEXP '[0-9]')
Posted 27 November 2012 - 02:49 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users