In my bank I have 3 columns for phone, I need to know if the value is in any of the 3 fields, what is the best way to assemble this select?
In my bank I have 3 columns for phone, I need to know if the value is in any of the 3 fields, what is the best way to assemble this select?
You can use a IN
"reverse" (than is normally used):
... WHERE '2345-6789' IN (tel1, tel2, tel3)
If it is a non-exact search, ie by numbers that contains a portion of the phone, you can do this:
WHERE telefone1 like '%123%'
OR telefone2 like '%123%'
OR telefone3 like '%123%'
Being 123
the number entered by the user in the search field.