按生日排序
Sort by birthdays
如何在他们生日前订购?年无所谓。
DELIMITER //
Create procedure radnicipodatumu(IN ulaz_date date)
Begin
select fname, lname, date_format(bdate, '%d.%m.%Y') as 'b_day', salary, bonus, state from employee
where
DAYOFMONTH(ulaz_date) = DAYOFMONTH(bdate)
OR MONTH(ulaz_date) = MONTH(bdate)
order by bdate;
end //
DELIMITER ;
call radnicipodatumu("2002-05-09");
将 bdate
格式化为 MMDD
并在 ORDER BY
子句中使用:
ORDER BY DATE_FORMAT(bdate, '%m%d')
或:
ORDER BY MONTH(bdate), DAY(bdate)
如何在他们生日前订购?年无所谓。
DELIMITER //
Create procedure radnicipodatumu(IN ulaz_date date)
Begin
select fname, lname, date_format(bdate, '%d.%m.%Y') as 'b_day', salary, bonus, state from employee
where
DAYOFMONTH(ulaz_date) = DAYOFMONTH(bdate)
OR MONTH(ulaz_date) = MONTH(bdate)
order by bdate;
end //
DELIMITER ;
call radnicipodatumu("2002-05-09");
将 bdate
格式化为 MMDD
并在 ORDER BY
子句中使用:
ORDER BY DATE_FORMAT(bdate, '%m%d')
或:
ORDER BY MONTH(bdate), DAY(bdate)