|
|
|
date: Tue, 2 Sep 2008 07:38:00 -0700,
group: microsoft.public.sqlserver.server
back
Help with SELECT DISTINCT
Hello,
I have a table called Products with columns ID (Primary key), Names,
Category, Store and Vendor. I want to get the unique names along with their
ID that fall under Category T, so I tried the following,
SELECT DISTINCT Names, ID
FROM Products
WHERE (Category = 'T')
But it doesnât seem to work. Then I tried SELECT statement with
DISTINCT(Names), but it didnât work
It works if I removed ID column from the SELECT statement. Any idea what is
wrong with the above query?
How do I run Distinct on one column but return 2 columns?
Thank you,
Joe
date: Tue, 2 Sep 2008 07:38:00 -0700
author: Joe
|
|