I have a table with multiple user_id and each one can redeem a discount code like this:
user_id | discount_code |
---|---|
1 | A |
2 | B |
3 | A |
1 | B |
2 | A |
1 | A |
1 | B |
2 | A |
2 | B |
3 | A |
I have to count the overlap of users for each discount code.
I think this should be the result:
A | B | |
---|---|---|
A | 3 | 2 |
B | 2 | 2 |