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)
 Temporary table question

Author  Topic 

macsterling
Yak Posting Veteran

56 Posts

Posted - 2010-04-11 : 10:20:41
Is there a way to sort of combine the count and distinct functions? If I have a column with different single letters in the alphabet. I want to know how many different letters are represented (not how many of each). If there are 20 A's and 32 B's and 12 D's
the answer is 3.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-04-11 : 11:53:27
[code]
SELECT COUNT(DISTINCT yourlettercol) FROM Table
[/code]

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

Go to Top of Page
   

- Advertisement -