what can i add to the following query "SELECT pubID, pubName, pubPostcode from Pubs" so that it only returns results if the pubID='2' or pubID='5' or pubID='9' etc.
i know you can do it using where clauses in separate queries but can it be done in a single call?
thanks
mysql query question
Moderator: General Moderators
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
Code: Select all
SELECT pubID, pubName, pubPostcode FROM Pubs WHERE pubID IN ('2','5','9')- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
lose the quotes for integersiknownothing wrote:Code: Select all
SELECT pubID, pubName, pubPostcode FROM Pubs WHERE pubID IN ('2','5','9')