Prepare for your Next Interview
This is a discussion on Order By Day Of week within the Oracle forums, part of the Databases category; I am having the select statement which is returning me the Day of the Week,ie. Mon, Tue, Wed etc. I need to order these days starting from Sunday and ...
|
|||
|
Order By Day Of week
I am having the select statement which is returning me the Day of the Week,ie. Mon, Tue, Wed etc.
I need to order these days starting from Sunday and ending on Saturday. Kindly let me know how to write a SQL script for this. |
| The Following User Says Thank You to Vasanth.sql For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: Order By Day Of week
To get the desired result in your question use :
select * from table order by to_char(date_column,'D') ; In the employees table we have hire_date column which is of datatype DATE. select hire_date from employees order by to_char(hire_date,'D'); To check this thoroughly try the below query: select hire_date, to_char(hire_date,'Dy'), to_char(hire_date,'D') dt from employees order by dt; |
|
|||
|
Re: Order By Day Of week
Quote:
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pls order please | lak211 | ASP.NET | 2 | 06-03-2008 04:33 AM |
| BO Designer Last week of the month | jd_usnj | Data Warehousing | 1 | 05-22-2008 02:00 AM |
| Need to have day of the week | srinivasa.dinesh | Unix/Linux | 0 | 03-19-2008 04:01 AM |
| Redirect to week.php instead of login.php | Geek_Guest | PHP | 0 | 05-16-2007 01:10 PM |
| Display record ordered by the day of the week | orlando | SQL | 3 | 03-01-2007 02:04 AM |