Reputation: 529
I want to list all the records that have more than one different collaborators ("added_by") as per table below:
The result expected are report_id having values 103, 104.
report_id having value 102 has been excluded because the entries have been added twice by the same user.
Upvotes: 0
Views: 35
Reputation: 522311
One way to translate your requirements is to aggregate your table by report and retain those reports having more than one distinct contributor.
SELECT
report_id
FROM yourTable
GROUP BY
report_id
HAVING COUNT(DISTINCT added_by) > 1
Upvotes: 2