I'm confused on how to write the following query in MySQL: Given one collaborator, I'd like to get all the collaborators that participated on each item that this collaborator worked on.
Here's my collaborators table:
id collaborator_id item_id
1 1 1
2 2 1
3 3 1
4 4 2
5 1 2
6 2 3
for collaborator_id=1, the query would return:
collaborator_id item_id
1 1
2 1
3 1
1 2
4 2
So collaborator_id=1 worked with collaborator_ids=2,3 on item_id=1 and worked by themselves on item_id=2.
This seems super simple but I'm having a brain freeze on how to get these results. Thoughts?