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
 Transact-SQL (2000)
 Another select question

Author  Topic 

hasanali00
Posting Yak Master

207 Posts

Posted - 2004-12-01 : 07:48:23
I want to select 'cat' 'dog' from 'animal' colum

So I write:

SELECT *
FROM animalList
WHERE (animal LIKE '%cat%') OR (animal LIKE '%dog%')

But is there any shorter way of writing this statement?

regards

Andraax
Aged Yak Warrior

790 Posts

Posted - 2004-12-01 : 07:52:48
Not really, if you want to use the LIKE operator. Otherwise you can do:

SELECT *
FROM animalList
WHERE animal in ('cat', 'dog')
Go to Top of Page
   

- Advertisement -