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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With Simple SQL Code(making field equal to multiple values) 2

Status
Not open for further replies.

Jdbenike

MIS
Sep 11, 2008
74
US
Code:
select distinct a.Homelaborlevelname5,
a.HomeLaborLevelDsc5
from vp_person a
where a.Homelaborlevelname5 = '1000'or
a.Homelaborlevelname5 = '1001' or
a.Homelaborlevelname5 = '1001' or
a.Homelaborlevelname5 = '1010' or

Let's say I have this code. Yet, I have like 20 more values a.HomeLaborlevelname5 can equal to. How can I do something to put it all into one nice statement.

Something like.

where a.Homelaborlevelname5 = ('1000','1001','1002')

How do I do this? I know it's simple, but it's also hard to search for something so simple. Thanks ahead of time.
 
Code:
where a.Homelaborlevelname5 IN ('1000','1001','1002')

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
using sql server TSQL use the following:

Where a.homelaborlevelname5 in ('1000','1001','1002',....)
 
thank you, works beautifully.. good weekend.. giving some thank you clicks now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top