SQL Count unique objects defined by parameters

Posted by Eduardo on Stack Overflow See other posts from Stack Overflow or by Eduardo
Published on 2010-06-12T00:09:57Z Indexed on 2010/06/12 0:12 UTC
Read the original article Hit count: 200

Filed under:
|

I have a table with:

id | parameter
 1 | A
 1 | B
 2 | A
 3 | A
 3 | B

That represent objects defined with the values as:

 1 -> A,B
 2 -> A
 3 -> A,B

I want to count the number of objects with different parameters using a SQL query, so in this case it would be 2 unique objects as 1 and 3 have the same parameters.

The database is a Microsoft SQL Server 2000. But I do not mind knowing the solution for other databases.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server