discount value in different records

0

Buenos Dias please, if you can guide me. I have a table called pago where the client is and another detalle where are the payments that the client must make.

I would like to know if the customer has in the table detalle 4 payments worth 500,000 and he pays 300,000 as I do so that he goes to each individual payment and discounted from each detail payment until the value he paid is over.

    
asked by Jesus Antonio Sanchez Sanchez 09.06.2018 в 12:26
source

1 answer

0

I do not know if I understood your question well, if you already know how many payments the client should make, it would be best to use an additional table to record each abono (linked to its detalle ). Additionally, for each registration you can discount the amount paid for the debt in detalle or, when you do the query, do the subtraction operation.

    
answered by 10.06.2018 в 07:39