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/Count?

Author  Topic 

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2009-03-11 : 05:41:37
I have a table:

group name
----- ----
law sue
admin bob
law mike
law geoffrey
admin graham
admin brendan

how can I ascertain how many groups there are please? (In the above case there are 2 - 'law' and 'admin')

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-11 : 05:46:49
SELECT COUNT(DISTINCT [Group]) FROM Table1



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2009-03-11 : 05:54:15
Many thanks Peso
Go to Top of Page
   

- Advertisement -