I have the following structure:
PURCHASE
id_compra
desc_compra
valortotal_compra
data_compra
id_colaborador
COMPRAPROD
id_compraprod
id_compra
id_produto
qtd_compraprod
valorunit_compraprod
valortotal_compraprod
COMPRAMAT
id_compramat
id_compra
id_material
qtd_compramat
valorunit_compramat
valortotal_compramat
I would like the value_to_purchase field in the PURCHASE table to receive the sum of the values value_compramat and , of the COMPRAMAT and COMPRAPROD tables, respectively.