Forum Moderators: coopster
This is my select:
$result=mysql_query("select sum(
case when MONTHNAME(llegada) = '$mes' and year(llegada) = '$anyos'
then comision
else null end
) as sum_comision_this_month
, sum(
case when MONTHNAME(llegada) = '$mes' and year(llegada) = '$anyos'
then pagado
else null end
) as sum_pagado_this_month
, sum(comision)
-sum(pagado) as total
from pagados
left outer
join bookings
on pagados.id_reserva = bookings.id where MONTHNAME(llegada) <= '$mes' and year(llegada) <= '$anyos'",$dbh);
This at the end is not correct, this code exclude some months....
on pagados.id_reserva = bookings.id where MONTHNAME(llegada) <= '$mes' and year(llegada) <= '$anyos'",$dbh);
I checked mysql dates and canīt find any, the only thing I can think is to put the exact dates in the dropdownmenu like this:
2004-10-31, 2004-11-30 etc., WHERE llegada >= '$fechas', but must be an better idea, to choose the year in one menu and the month in another