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 2000 Forums
 SQL Server Development (2000)
 Count Distinct

Author  Topic 

rc113943
Starting Member

2 Posts

Posted - 2007-09-07 : 10:12:56
So everyone knows how Distinct works. What I'd like to do, is find out how many records were grouped together in each distinct record.

I tried using Count in this manner

Select count(*) from (select distinct ParentSeries, Series, Operating, Spacer, Gas, ILite, IThick, CLite, CThick, OLite, OThick, Grids from H_ImportItems where Part = 0 ) as new_table


but it only gave me the total amount of distinct records, not the amount of records in each distinct group.

Is this possible? Appreciate your help!!

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-07 : 10:27:39
ou have to use GROUP BY to acctually create the groups youwish to count items is.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -