1
How could I select in two tables bringing the column data SKU of both tables even if the data of one table does not exist in the other table, also need to delete the repeated data.
These are the table data item_divergence
This is the table data item_inventarios
This is the expected result;
I tried using SQL below but my query became too slow to query with many items;
SELECT (IVT.sku) as SKU
FROM item_divergencia as IDV
INNER JOIN item_inventarios as IVT on (IDV.id_inventario = IVT.id_inventario)
WHERE IDV.id_inventario='252'
UNION
SELECT (IDV.sku) as SKU
FROM item_divergencia as IDV
INNER JOIN item_inventarios as IVT on (IDV.id_inventario = IVT.id_inventario)
WHERE IDV.id_inventario='252'
ORDER BY SKU
Perfect explanation. However using LEFT JOIN would not bring the desired result because in the two tables I have rows of the SKU column that exists in one and does not exist and vise and versa.
– Hugo Rutemberg
Thanks, I saw that Group By was helpful! I hope I helped
– Leonardo Negrão
It was yes. It helped a lot. Thank you!
– Hugo Rutemberg
No reason, if it is possible to give the Thumbs up
– Leonardo Negrão
I edited to leave only GROUP BY, which was really useful. Abs
– Leonardo Negrão