1

I'm trying to only select the data with numbers in them (the table looks like this):

eteee 231
wrgrr
test 1
bioo 21
wee

with the query: SELECT address1 FROM ps_address WHERE address1 not like '%[^0-9]%';

but i get all the values right back.

3 Answers3

2

You can simply write:

SELECT address1 FROM ps_address WHERE address1 like '%[0-9]%';
iminiki
  • 2,549
  • 12
  • 35
  • 45
0

this will work :

SELECT address1 FROM ps_address WHERE regexp_like(address1,'.*[0-9]+.*');
Nikhil S
  • 3,786
  • 4
  • 18
  • 32
0

Try this REGEXP:

SELECT address1 FROM ps_address WHERE address1 REGEXP '[[:digit:]]';

This returns the rows containing digits anywhere inside address1.

forpas
  • 160,666
  • 10
  • 38
  • 76