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)
 Counting multiple instances in a table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-08 : 08:41:57
Dror writes "I have a table which looks like this:

id (column name)
1
1
2
2
3
4
4
4
5
5

I need to get 2 things from the table:
1) A count of how many instances the table has where id is
the same.

So for this table the count would be 4 since all numbers
except (3) have more than one instance.

2) a recordset which will give me the (id) and the count of the numbers of instances in the table

So for this table I would get:
(1) count=2
(2) count=2
(3) count=1
(4) count=3
(5) count=2

I appreciate a response
Thanks
Dror"
   

- Advertisement -