Posted 26 November 2012 - 04: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 - 06:22 PM
Posted 26 November 2012 - 08:59 PM
SELECT model FROM products WHERE model != '' AND model != '0' AND (model REGEXP '[0-9][a-z]' OR model REGEXP '[0-9]')
Posted 26 November 2012 - 09:49 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users