0
I have a BD view where I need to bring a total amount of KG/LT of products expected to receive in the company, I need to include a condition that when the unit is TON or TN it multiplies by 1000, because when it is ton, it calculates as if it were normal unit, this information is taken from XML, it is possible to?
Follow the current query:
SELECT SUM(i_prod_quant) as QUANT, pha_table.pha_emp as EMP FROM pha_table
INNER JOIN phs_table ON pha_table.pha_parceiro_cnpj = phs_table.phs_parceiro_cnpj
INNER JOIN nfe_table ON nfe_table.nfe_chave = phs_table.phs_nfe_chave
INNER JOIN i_nfe_table ON i_nfe_table.i_nfe_chave = nfe_table.nfe_chave GROUP BY EMP
Ulysses, from what I understood the field "i_prod_quat" has the information regarding the quantity of the product, but would there be a field that informs what is the unit related to the quantity of the product? If yes, what would this field be? You can include in your question a diagram of your pha_table?
– Sérgio Lopes