select - How to sort by three-characters weekday in MYSQL -
i have mysql table column three-characters weekdays like
mon, tue, wed, thu..
now want order select query these weekdays (not alphabetically!). when following line, it's doesn't work:
select * table order str_to_date(day, '%a')
can give me working query?
try below code
select * `table` order field(`day`, 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');
Comments
Post a Comment