I am using a postgresql setup and I have a table something like this:
sec_id prod_id
1 789
1 908
1 678
13 789
13 123
13 908
15 789
What I want to be able to is determine the overlap (common prod_ids) within the sec_id's. That is, I want to be able output something similar to:
sec_id1 sec_id2 overlap
1 13 2
1 15 1
13 1 2
13 15 1
15 1 1
15 13 1
I don't have very much experience with this and would appreciate any assistance.