I am trying to write syntax that checks for group membership based on a single table. I have users that are in the table multiple times (meaning, multiple rows), so I might have data that looks like this:
user region field1
---- ------ ------
282 10 38
282 10 128
464 3 57
etc.
What I need is syntax that says “Group A = Region 10 and ANY of these numbers in the FIELD1 column – 38, 79, 126. Then Group B = Region 10 and ANY of these numbers in the FIELD1 column – 80,128”
Now, as you can see from my example, user 282 would be considered in BOTH Group A and Group B. Ultimately, I’m looking to find out who is in both groups. I did a GROUP_CONCAT to show me that they’re in the same group but how do I count them or even filter on the ‘Groups’?
Use a self-join: