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 2005 Forums
 Transact-SQL (2005)
 Distinct Select statement

Author  Topic 

dr223
Constraint Violating Yak Guru

444 Posts

Posted - 2009-04-30 : 09:23:42
Hi,

I have table (tablea) as shown below

A B C

John 12 apple
John 12 apple
John 12 cabbage
John 12 cabbage
James 13 Banana
Julie 14 Grapes


What I want to do is display distinct value from column C with their respective values from A & B.

Therefore my output result should look like;

John 12 apple
John 12 cabbage
James 13 Banana
Julie 14 Grapes


How can i use the distinct statement to retrieve the data?

Thanks



whitefang
Enterprise-Level Plonker Who's Not Wrong

272 Posts

Posted - 2009-04-30 : 09:25:11
SELECT DISTINCT * FROM [table]
Go to Top of Page
   

- Advertisement -