0

I need remove dots and hyphens on a string on compare in Where clause.

This is my query now:

Select * from tbl_sometable where some_column in ('10000000000', '1999999999')

But, the some_column have values like this: '129.012.120-01' and I need filter the values too, like the values in a clause "in".

How I can do this? I using MySQL, I see an example using Translate, but not work in MySQL.

Thanks and best Regards.

Marcos Bergamo
  • 973
  • 2
  • 10
  • 19
  • There is a post here that looks like it would solve your problem: http://stackoverflow.com/questions/287105/mysql-strip-non-numeric-characters-to-compare – dub stylee Apr 07 '14 at 17:41

2 Answers2

1
WHERE
  REPLACE
    (
      REPLACE
       (
         some_column, "-", ""
       ), ".", ""
    ) in ('10000000000', '1999999999')
Abhik Chakraborty
  • 43,914
  • 5
  • 48
  • 61
1
WHERE REPLACE(REPLACE(some_column, '.', ''), '-', '') in ('10000000000', '1999999999')
Linger
  • 14,686
  • 23
  • 50
  • 76