0

I have a VARCHAR type field that can contains both numeric (222) or alpha-number (CPO13) values.

I want to select only values that are numeric? I see in example how to choose non-numeric but I want to filter out those with letters of the alphabet?

Rocco The Taco
  • 3,695
  • 13
  • 46
  • 79
  • If you know how to choose non-numeric values, just add `NOT` to the `WHERE` condition and it will filter them out. – Barmar Jul 11 '18 at 20:17

1 Answers1

1

You can try using a Regular Expression that filters for values with both numeric and alphabetical characters . For example:

SELECT * FROM DATA WHERE FIELD REGEXP NOT '[A-z].[0-9]';

mySQL allows you to use regular expression as a filter !

This should select out for values like CPO13. If you want to practice regular expressions this is a great website to test whether you have the right regex. https://regex101.com/

Hope this helps !

Nadim Younes
  • 800
  • 1
  • 6
  • 11