2
I’m making a system in PHP, but I’m stuck because I can’t find the solution to a challenge.
I have 2 tables, a call objetos
and another call gavetas
. I have several names of drawers registered in the table gavetas
and I need to know which ones have object inside them.
I’m trying to make a select
where whether or not you have an object inside the drawer, bring all the records from the table gavetas
and those that have object, is displayed the name of the object on the side. And when you have ( Pen ) inside the drawer PHP prints the word ( found ) next to the object name. I’ve tried INNER JOIN / LEFT JOIN / RIGHT JOIN
, but I’m not getting the desired result.
Tables:
**Gavetas**
id
nome-gaveta
**Objetos**
id
nome-gaveta
nome-objeto
Example
Gaveta 1 / Caneta - Encontrado
Gaveta 2 /
Gaveta 3 /
Gaveta 4 /
Gaveta 5 / Borracha
Have you tried a select using full Outer Join? select from table a full Outer Join table b on a.id = b.id, if possible post the select q vc is trying to do.. hugs
– Diego Lela
What the
SGBD
used?– Sorack