Reputation: 59
I have a list of hand listed uniqueID that I want to retrieve from my MySQL database. As of now, I'm using:
Select * from TABLE where uniqueID = "111" or uniqueID = "124" or uniqueID = "220"...
Obviously this is very time consuming. The list of uniqueID is not written in any file. I just want more efficient query to tell the database to retrieve the rows with the uniqueIDs. Is there something like,
Select * from TABLE where uniqueID = {"111", "124", "220"...}
that I could use?
Thank you.
Upvotes: 0
Views: 93
Reputation: 135808
Select * from TABLE where uniqueID IN ('111','124','220',...)
Upvotes: 3