How can display the record ordered by the day of the week, STARTING WITH MONDAY? My results always start with Sunday which is the first day of the week.
Printable View
How can display the record ordered by the day of the week, STARTING WITH MONDAY? My results always start with Sunday which is the first day of the week.
Hi Orlando,
Small change in ORDER BY clause, [B]order by to_char(hiredate -1,'D') [/B]will do the trick.
SQL> select hiredate, to_char(hiredate,'DAY') from emp order by to_char(hiredate,'D');
The above query will order the week days starting from sunday whereas with the order by change, similar to the following query, [B]the week days will be ordered from Monday to Sunday.[/B]
[B]SQL> select hiredate, to_char(hiredate,'DAY') from emp order by to_char(hiredate -1,'D');[/B]
Hopefully it helps u.
Thank you Innila.
It works great!
Orlando
Hi Orlando,
Nice that the option helped you.
Another information, if u find a post satisfying, then click "Thanks" button available in the right corner of the particular post u want to thank. :-)