Reputation: 537
I need to find if a record id is on the same group id more than once.
group id | record id | comments -------------------------------- 3 1 3 1 4 2
In this case, the record with id 1 is being associated with group id 3 twice.
Is there a query that can provide all records with this behaviour?
Thanks
Upvotes: 0
Views: 49
Reputation: 17600
This query should do the job:
select t.group_id, t.record_id
from [your_table] t
group by t.group_id, t.record_id
having count(*) > 1
Upvotes: 2