SQL 2005 - Search on Multiple String values

I want to perform the following Select statement against the DB:
SELECT Mac, Workstation_Name, IP_Address, User_Name
     from myDb.dbo.network
Where Workstation_Name = 'PC1' AND 'PC2' AND 'PC3'...etc.

But, obviously that doesn't work. What is the Select..Where....syntax to search for 2 or more values
in the Where clause?
Thanks,
Wallace
wally_davisAsked:
Who is Participating?
 
mdouganConnect With a Mentor Commented:
The best choice is to use the IN clause

SELECT Mac, Workstation_Name, IP_Address, User_Name
     from myDb.dbo.network
Where Workstation_Name IN ('PC1','PC2','PC3')

However this would be more of an OR statement than an AND statement... in other words, if the workstation name was any of those items, then include it.
0
 
wally_davisAuthor Commented:
Thank you!! I tried everything but the parenthesis.
0
 
mdouganCommented:
LOL, yes, those are important!
0
All Courses

From novice to tech pro — start learning today.