Hi, I’m not a newbie, but apparently I still have lots to learn.
I have a table of users (users) that can belong to multiple organizations (one to many) so I use a linking table (user_orgs) to link to my organizations table.
I’m trying to write a query that will allow me to select one or more organizations and display a list of users that belong to at least one of the selected organizations, but unfortunately MySQL doesn’t have an INTERSECT to use.
Ideally I’d like to do an intersect on the set of organizations chosen, i.e., (1, 2, 3) and all the records in the user_orgs linking table that match the chosen organizations.
Am I making sense?
Can someone give me a clue what I need to do here? I’m using PHP.