The below query will return all (id, product_id) combinations that match more than 1 record. This may not be the best method for your problem, but it's one that I know will work based on what you've told us so far.
- SELECT id, product_id, COUNT(*) AS myCount
-
FROM prd_bal
-
WHERE date = '30-jun-2006'
-
GROUP BY id, product_id
-
HAVING myCount>1;
Note:
"id" is traditionally used as the primary key for most tables. If this is the case for "prd_bal", and it is unique (I would hope), then the above query will return no results. This should get you where you want to go though.