Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple(for you guys) query question. 1

Status
Not open for further replies.

paul172

Technical User
Feb 20, 2003
117
GB
Say I have a table with a couple of hundred records in it.

I only want to return records 1, 3, 7, 10, 14, 20, 89 etc etc....

I would assume(wrongly) that the syntax would be the following -

select * from table where field = 1, 3, 7, 10.......etc

Can someone point me in the right direction?

Thanks,
Paul
 
Code:
select *
from table
where field IN(1,3,7,10)

You will need single quotes if string values
 
Select * from Table Where Field In (1,3,7,10....etc)

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Sorry simonchristieis!!! My typing was a little slower than yours :)
 
Cheers guys, it worked a treat!!!

I'll give the star to Simon as he was the quickest off the mark!;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top