I have the table factura_habitaciones
, where you enter the room reservations that I will later invoice.
I want to calculate the total of all the records in the table with a single sentence in MySQL considering that
numero_huespedes > 4
, since the 4
first ones do not cost) The total is point 1) added to point 2)
How do I calculate the huesped #5 (>4)
with the following sentence:
SELECT SUM( precio_habitacion * dias ) + SUM( numero_huespedes *50000 )
FROM facturacion
pd: the where numero_huespedes > 4
at the end does not work since it would not calculate the precio_habitacion * dias
when the condition is not fulfilled