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
 General SQL Server Forums
 New to SQL Server Programming
 SQL filtering by multiple items in the same column

Author  Topic 

orc_orc
Starting Member

1 Post

Posted - 2010-10-14 : 12:58:54
Hello, I have a table such as like that
GROUPS
ID | NAME
--------+---------
1 | Amazon.com
2 | Buy.com
3 | eBay.com
4 | Dealers
5 | Distributors

I want to write a query that lets me filter multiple items in the same column.

SELECT GROUPS.NAME FROM GROUPS WHERE GROUPS.NAME = 'Amazon.com' AND 'Buy.com'

It should be filtered by an numbers like GROUPS.NAME = 'Amazon.com' AND 'Buy.com' AND ... AND .. so on

If someone can help me with query I will be glad. Thanks

Sachin.Nand

2937 Posts

Posted - 2010-10-14 : 13:00:44
Have you heard of the IN clause in SQL ?If not then please have a look at it in msdn or BOL..

PBUH

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-10-17 : 02:21:57
how will you be passing the values to be filtered? as a comma separated list?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -