Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Display record ordered by the day of the week

This is a discussion on Display record ordered by the day of the week within the SQL forums, part of the Databases category; 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....

Go Back   Geeks Talk > Databases > SQL
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 02-28-2007
Junior Member
 
Join Date: Feb 2007
Posts: 8
Thanks: 2
Thanked 1 Time in 1 Post
orlando is on a distinguished road
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.
Reply With Quote
The Following User Says Thank You to orlando For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 02-28-2007
Expert Member
 
Join Date: Sep 2006
Location: India
Posts: 131
Thanks: 1
Thanked 21 Times in 20 Posts
Innila is on a distinguished road
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 ***
Reply With Quote
The Following User Says Thank You to Innila For This Useful Post:
  #3 (permalink)  
Old 03-01-2007
Junior Member
 
Join Date: Feb 2007
Posts: 8
Thanks: 2
Thanked 1 Time in 1 Post
orlando is on a distinguished road
Re: Display record ordered by the day of the week

Thank you Innila.
It works great!

Orlando
Reply With Quote
  #4 (permalink)  
Old 03-01-2007
Expert Member
 
Join Date: Sep 2006
Location: India
Posts: 131
Thanks: 1
Thanked 21 Times in 20 Posts
Innila is on a distinguished road
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 ***
Reply With Quote
Reply

  Geeks Talk > Databases > SQL

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Record and Playback feature Lokesh M Test Cases 3 12-30-2008 11:18 AM
Loading for 6th Record JobHelper Data Warehousing 5 07-08-2008 10:01 AM
Display n-1 rows from a table dbtester SQL Server 3 02-07-2008 08:11 AM
With Joyce Audio Converter you can sort out all your audio files and make an ordered JobHelper Geeks Lounge 0 01-03-2007 02:02 PM
Difference between V, VB, VBA record formats Lokesh M VB.NET 0 12-07-2006 05:57 AM


All times are GMT -4. The time now is 01:15 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved