Reputation: 33
I have a simple MySQL query that looks something like this
SELECT *
FROM table
WHERE (id = 1173)
OR (id = 223)
OR (id = 363443)
OR (id = 11532)
OR (id = 45663)
OR (id = 28313)
OR (id = 717713)
OR (id = 128313)
And so on with about 10-100 ORs per query.
I'm just wondering if there's a more efficient or cleaner way of performing this query.
Upvotes: 3
Views: 95
Reputation: 7583
Yes. You can use IN
, like this
SELECT * FROM table WHERE id IN (1173,223,363443,11532,45663,28313,717713,128313)
Upvotes: 6