Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query streamlining, will this work?

Author  Topic 

sbt1
Yak Posting Veteran

89 Posts

Posted - 2005-01-14 : 13:50:02
Instead of writing a query like this:
SELECT Name FROM Table WHERE (User = 'Apple' OR User = 'Pear' OR User = 'Cherry') (you get the idea)

Can it be written like this:
SELECT Name FROM Table WHERE (User in 'Apple','Pear','Cherry')

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2005-01-14 : 13:53:48
Sure. The syntax is like this:
SELECT Name 
FROM Table
WHERE User IN ('Apple','Pear','Cherry')
Go to Top of Page
   

- Advertisement -