sql >> Base de Datos >  >> RDS >> Mysql

MySql - ordenar por nombre de mes

puede especificar como

ORDER BY FIELD(MONTH,'January','February','March',...)


SELECT leave_balance.balance, MonthName(leave_balance.date_added) AS month 
FROM leave_balance WHERE leave_balance.staff_id_staff = $iid 
GROUP BY month,  leave_balance.leave_type_id_leave_type 
HAVING leave_balance.leave_type_id_leave_type = $leaveBalTypID 
ORDER BY FIELD(MONTH,'January','February','March',...,'December');