Results 1 to 4 of 4

Thread: Display record ordered by the day of the week

  1. #1
    Junior Member
    Join Date
    Feb 2007
    Answers
    6

    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.


  2. #2
    Expert Member
    Join Date
    Sep 2006
    Answers
    130

    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.

    *** Innila ***

  3. #3
    Junior Member
    Join Date
    Feb 2007
    Answers
    6

    Re: Display record ordered by the day of the week

    Thank you Innila.
    It works great!

    Orlando


  4. #4
    Expert Member
    Join Date
    Sep 2006
    Answers
    130

    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. :-)

    *** Innila ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact