I need to combine 2 tables, make a summary and get their differences. In the services table I have the cost of the service, in the payment table I have the amounts and means of payment associated, as I can make a summary in such a way that independent of the amount of means of payment does not double the value of the service. p>
I'm in the design stage, so I can also change the design of the tables if the solution warrants it.
Table1_Services
ID_Serv Servicio Monto
1 59927840701 118.441,50
Table2_Payments
ID_Pago Pago Monto ID_Serv
3 Debito 39.480,50 1
4 Credito 78.961,00 1
Query_Totals
Total_Servicios Total_Pagos Diferencia
236.883,00 118.441,50 -118.441,50
** Error in Total_Service , is duplicated by having the same associated index twice