Resta entre dos campos SQL
hola buenos dias tengo el siguiente problema necesito obtener la diferencia entre dos campos. Dichos campos tengo que sumar el total de todos sus valores y luego hacer la restar PERO ME TIRA CUALQUIER RESULTADO UNA VEZ HECHA LA RESTA DESDE YA AGRADEZCO SUS RESPUESTAS SELECT SUM(ovd.precio_unitario_final) - SUM(pd.suma_pago) AS diferencia FROM pagos p INNER JOIN orden_venta as ov on p.id_ov = ov.id_ov INNER JOIN pagos_detalle as pd on p.id_pago = pd.id_pago INNER JOIN orden_venta_detalle as ovd on ov.id_ov = ovd.id_ov GROUP BY ovd.precio_unitario_final , pd.suma_pago
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.