I have 3 Tables
Table Produtos
with columns id
, descricao
, peso
.
Table op_itens
with columns id_op
, id_prod (chave estrangeira da tabela Produtos com a coluna id)
, qtd
.
I want to make a sum of the total weight amount of the op_itens table
example:
Products Table
id | description | weight
1 | Pencil ......... | 0,12
2 | Rubber ... | 0.02
op_itens table
id .process id | qtd
1 .. | 1 ........... | 5
1 .. | 2 ........... | 10
I would like a total quantity result of the items that in this case is 15. and Total Weight would be 0.8
I have tried several command SELECT SUM
, but it is returning me values that is not correct.