I'm very new with MySQL and have been stuck on a query for a while. I thought I would have to use a subquery but doing that didn't work because it returns multiple rows. Here's what I've got so far:

```
    SELECT im.fb_id, im.interest_id, i.name
    FROM interest_map AS im
    LEFT JOIN interests AS i ON i.id = im.interest_id
    WHERE i.category = 'Pet supplies'

```

This gives me all of the users who have interests under the category 'Pet supplies'. What I want is to:

1. Start with user A
2. Collect all of user A's interests under category X
3. Find all other users who have matching interests

The interests don't need to match explicitly, meaning that User A can have interests 1, 2, 4 and User B can have interests 2, 3, 5 and they would still match on interest 2.

My tables look like this:

```
    users: id, firstname, last_name
    interests: id, name, category
    interest_map: user_id, interest_id

```

Also if anyone knows what this kind of query is called so I can read up about other queries like it I would really appreciate that!