0

I have a contacts column which has, an id and sms (array) columns. I would like to remove all non US numbers (all numbers that starts with 1) And I am not quite sure how to do this.

I am not sure if it would be appropriate to do a FOR LOOP for this query or should I do a simple query? Is there any way to do this query?

Bon Andre Opina
  • 2,129
  • 2
  • 15
  • 33

1 Answers1

0

If you decide to do it on an SQL query: Assuming column where you store all the phone numbers: to be like phone You could use a query like this:

SELECT * FROM sms WHERE phone NOT LIKE '+1%' AND phone NOT LIKE '1%' AND phone NOT LIKE '001%' AND phone NOT LIKE '01%'

And If you decided to do it on code, you could use a regular expression instead:

RegEx to Validate US numbers

In think If you give us more information, we could be able to help you in a better way. Regards,

JGuarate
  • 378
  • 3
  • 9