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
 Distinct Values in Select Statements

Author  Topic 

munkdogg
Yak Posting Veteran

53 Posts

Posted - 2006-07-06 : 10:32:52
Hello,

I have a table, which contains well over 30'000 rows. One of the Columns is for ransaction type, of which there are about 20-25 different types.

I am trying to pull a list of each type value, using a select distinct TSQL command...but thus far am unsuccessful.

Has anyone had a similar situation?? Am I wrong in using a Select Distinct?? Many thanks to all who reply!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-07-06 : 10:34:09
select distinct transaction_type from table


KH

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-07-06 : 11:02:24
I sometimes like to know the distribution of things

SELECT transaction_type, COUNT(*) AS ROW_COUNT FROM myTable99 GROUP BY transaction_type

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

munkdogg
Yak Posting Veteran

53 Posts

Posted - 2006-07-06 : 11:02:40
Perfect, that worked!!

Thanks so much.
Go to Top of Page
   

- Advertisement -