-
Junior Member
Display record ordered by the day of the week
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.
-
Expert Member
Re: Display record ordered by the day of the week
Hi Orlando,
Small change in ORDER BY clause, order by to_char(hiredate -1,'D') 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, the week days will be ordered from Monday to Sunday.
SQL> select hiredate, to_char(hiredate,'DAY') from emp order by to_char(hiredate -1,'D');
Hopefully it helps u.
-
Junior Member
Re: Display record ordered by the day of the week
Thank you Innila.
It works great!
Orlando
-
Expert Member
Re: Display record ordered by the day of the week
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. :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules