July 19, 2007 at 12:01 pm
I need help with a query . Example Data in the table is as given below.
PRODUCTID Value
1 20
2 10
3 20
4 15
5 8
6 9
7 10
8 20
For each distinct "value " I would like to find and output which "Value" has more than one productID assigned.
For the above given example, the query output should be as guve below because Value - 20 and 10 have more than one productid assigned.
PRODUCTID Value
1 20
2 10
3 20
7 10
8 20
Please help me with this query.
Thanks
July 19, 2007 at 12:15 pm
July 19, 2007 at 2:22 pm
SELECT d.PRODUCTID, d.Value FROM Table1 AS d
INNER JOIN (SELECT Value FROM Table1 GROUP BY Value HAVING COUNT(*) > 1) AS t ON t.Value = d.Value
N 56°04'39.16"
E 12°55'05.25"
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply