I have a `"messages"` table with columns: `"id"`, `"title"`,

`"categories"` table with columns: `"id"`, `"title"`,

and `"messages_categories"` link table with columns: `"message_id"`,`"category_id"`.

lets assume we have `messages` with ids of 

```
1,2,3

```

and `categories` with ids of

```
1,2,3

```

`messages_categories` with data of

```
message: 1, category: 1

message: 2, category: 1

message: 2, category: 2

message: 3, category: 1

message: 3, category: 2

message: 3, category: 3

```

I want to find the exact match or more for example

if I search for category 1 i'll get messages 1,2,3

if I search for category 1,2 i'll get messages 2,3

if I search for category 1,2,3 i'll get only message 3

i'm using a lot of ids so join for every category can be too much.

I figured out I can use `"having"` statement with `"sum"` and `"count"` to find the exact rows
but it's not good enough.

Appreciate any help, Nevo.