I have tables: dog, owner, and dogowner which contains info about which owner have dog.

```
 ___Dog__    _Owner__    ___Dogowner___
 |id|name|   |id|name|   |id|dog|owner|
 |1 |dog1|   |1 |own1|   |1 | 2 | 1   |
 |2 |dog2|   |2 |own2|   |2 | 1 | 2   |
                         |3 | 2 | 2   |

```

And I want to select only the dog that is free to pick for owner. For example, own1 have dog2, so he have to see only dog1 avaible. Own2 have dog1 and dog2 so he cant choose anymore.

I tried query that should return 0 rows, but in result I always have one row:

```
select a.id as id, a.dog as dog from dog a left join dogowner b on a.id=b.dog WHERE b.owner<>'2' group by b.dog

```

Maybe first I have to group the dogowner table and then select?