Hello. I suffer the second day.
Suppose there is a table of users with the id and name fields (id is unique), and there is a linked table linking these users with groups. In this table, the user_id and group_id fields. You need one request to get users who are simultaneously in group 6 and group 12.
It seems simple, but something does not work. :( I could only get all the users who are in group 6, and all those who are in group 12, and then filter the extra code, but in view of a very large amount of data - the sample takes 7 seconds, which is extremely indecent for a long time ... I will grateful for any ideas ...