0
I am trying to make a table that presents a set of elements, where if a given id is in another table, then that element cannot be in the first.
Albums | id1 | id2 (Foreign Key)|
Capas| id2 |
Compras| id3 | id1 (Foreign Key da Tabela1)| id4 |
Clientes| id4 |
My goal is to present the Albums, excluding those that are already associated with a particular Client.
In a way, I realized that:
select * from Albums inner join Capas using(id2);
Allow me to get everything.
and
select * from Clientes inner join Compras using(id4) inner join
Albums using(id1) inner join Capas using(id2) where id4 ='1';
Allows me to obtain the results for a particular Customer.
Logically I thought that to get that I would have to put together in a certain way both orders, however I have not yet achieved positive results.
If you could help me, I’d really appreciate it!!