[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2100
  • Last Modified:

Select where like [ignore whitespace] (telephone # matching)

Hi Is there an easy way to write a select using like that ignores any whitespace.

Basically I  need to match telephone numbers that may or may not have been initially input with spaces included.

e.g.
select * from customers where telephone like "123456"

would match fields where telephone = "123 456" or "123456" or " 123456" or "12 34 56"

Am I going to have to clean my data and force all user input ino this clean format or is there a select I can use on the data I have?

Many thanks,

Mal
0
malcx
Asked:
malcx
1 Solution
 
todd_farmerCommented:
select * from customers where REPLACE(telephone, ' ', '') like "123456"
0
 
malcxAuthor Commented:
Lovely thanks - exactlywhat was needed,

Ta
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now