I have a table with four columns:
PartNumber, ValvePartNumber, ActuatorPartNumber, Price
I want to find the number of distinct prices for each combination of ValvePartNumber and ActuatorPartNumber.
This is using SQL Server 2005
I have a table with four columns:
PartNumber, ValvePartNumber, ActuatorPartNumber, Price
I want to find the number of distinct prices for each combination of ValvePartNumber and ActuatorPartNumber.
This is using SQL Server 2005
You can combine COUNT(DISINTCT)
and GROUP BY
to accomplish this.
SELECT ValuePartNumber, ActuatorPartNumber, COUNT(DISTINCT Price) AS Prices
FROM [Table]
GROUP BY ValuePartNumber, ActuatorPartNumber