People need help, I need to create a report that shows the total quantity of each product in stock, but I can not get the name of the products, only the product code and the sum of the quantity of the products I have. Here is the code I did:
SELECT
c.COD_PRODUTO,
SUM(b.QTD_SALDO) AS SALDO
FROM ESTOQUE_1 b
INNER JOIN ESTOQUE_2 c ON b.COD_PRODUTO = c.COD_PRODUTO
WHERE COD_PRODUTO IN ('6306','6308','6307','6234')
GROUP BY COD_PRODUTO;
In this code I have the following return:
SKU SALDO
------------------------- ----------
51231535 210
68000512 24
50388958 1000
50387203 6000
I need the name of the item to appear, as shown below:
NOME SKU SALDO
----- ------------------------- ----------
51231535 210
68000512 24
50388958 1000
50387203 6000
The table that contains the product name is the STOCK_2
The table structure is:
ESTOQUE_1
COD_PRODUTO | QTD_SALDO
ESTOQUE_2
COD_PRODUTO | NOME_PRODUTO