I have 2 tables and I want to retrieve the rows from the first table where the id_apartment does not appear in the second table:
id | id_floor | id_apartment
----+----------+--------------
1 | 0 | 101
2 | 1 | 101
3 | 1 | 102
4 | 1 | 103
5 | 1 | 104
6 | 2 | 201
7 | 2 | 202
8 | 2 | 203
table2.id | table2.guest | table2.apartment_id
----+---------------+--------------
1 | 65652 | 101
2 | 65653 | 101
3 | 65654 | 101
4 | 65655 | 101
5 | 65659 | 102
6 | 65656 | 201
7 | 65660 | 202
8 | 65661 | 202
9 | 65662 | 202
10 | 65663 | 203
expected output:
floor | number
-------+--------
1 | 103
1 | 104
I tried using LEFT, INNER and RIGHT join but I always get EMPTY results. How can I manage this?