0
Staff need a help, I need to create a report that shows the total quantity of each product in stock, but I can not make appear the name of the products, only the product code and the sum of the quantity of products I have. Below is the code I made:
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 item name to appear as an example below:
NOME SKU SALDO
----- ------------------------- ----------
51231535 210
68000512 24
50388958 1000
50387203 6000
The table containing the product name is ESTOQUE_2
The structure of the table is:
ESTOQUE_1
COD_PRODUTO | QTD_SALDO
ESTOQUE_2
COD_PRODUTO | NOME_PRODUTO
Thanks Rovann, it worked out here!!!
– Ikki_Nogueira
@Ikki_nogueira do not forget to mark as response. Thank you and welcome to the community.
– Rovann Linhalis