Reputation: 4115
I am doing a query where i would like to find the smartest way to define OR statements to reduce my query dump.
I have following headers in my table:
| id | subscriber | phonenumber | type |
So i wish to make a query where i only want to fetch type
values equal to typeOne
, typeTwo
and typeThree
.
Which is the smartest way?
Thanks in advance.
Upvotes: 1
Views: 1115
Reputation: 70678
SELECT *
FROM YourTable
WHERE type IN ('typeOne', 'typeTwo','typeThree')
Upvotes: 0
Reputation: 183602
You can use an IN
clause:
WHERE `type` IN ('typeOne', 'typeTwo', 'typeThree')
Upvotes: 5