GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL Plus
Go To First  |  Previous Question  |  Next Question 
 SQL Plus  |  Question 114 of 132    Print  
How can we order the column of day (mon to sun)such that monday comes first then tues and so no.Suppose we have retrieved day out of hiredate column

  
Total Answers and Comments: 15 Last Update: July 09, 2009     Asked by: Divya 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: deepak singh
 
if you want to accurate answare then you excu. this query...........................select TRUNC(SYSDATE) date, to_char(SYSDATE,'day') day from DUAL order by to_char(TRUNC(SYSDATE)-1,'d')

Above answer was rated as good by the following members:
prateekm
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
September 17, 2006 02:47:56   #1  
Madhuri        

RE: How can we order the column of day (mon to sun)suc...

select hire_date to_char(hire_date 'day') as day from employees order by to_char(hire_date 'd')


 
Is this answer useful? Yes | No
September 20, 2006 09:07:57   #2  
Divya        

RE: How can we order the column of day (mon to sun)suc...

thanks Madhuri...

but the result i m getting is in the order from sun then mon till sat(sun to sat)..

but i want to order it from mon then tue till sun(mon to sun).

If possible plzz tell me the query for that.


 
Is this answer useful? Yes | No
September 22, 2006 02:16:15   #3  
Hari        

RE: How can we order the column of day (mon to sun)suc...
hi divya! its simple. Note down the query.select to_char(hiredate 'day') from emp order by to_char(hiredate-1 'd')then u'll get d result as u like
 
Is this answer useful? Yes | No
September 27, 2006 03:51:55   #4  
Divya        

RE: How can we order the column of day (mon to sun)suc...

Thanks Hari

now i m getting the desired output...


 
Is this answer useful? Yes | No
October 06, 2006 14:33:56   #5  
shwetadubey Member Since: August 2006   Contribution: 2    

RE: How can we order the column of day (mon to sun)suc...

hi..m shweta ..

i m working in oracle too..

can we xchange our mail id's...if yes mail me at..shweta_m_dubey@yahoo.co.in


 
Is this answer useful? Yes | No
October 09, 2006 06:12:18   #6  
sushil        

RE: How can we order the column of day (mon to sun)suc...

Hi dea

ur answer is a bit wrong its because it thn give u the output as sun to sat and not mon to sun

rgds.

-Sushil


 
Is this answer useful? Yes | No
October 09, 2006 06:14:11   #7  
sushil        

RE: How can we order the column of day (mon to sun)suc...
select to_char(hiredate 'day') from emp order by to_char(hiredate-1 'd')
 
Is this answer useful? Yes | No
November 07, 2006 02:13:20   #8  
deepak singh        

RE: How can we order the column of day (mon to sun)suc...
if you want to accurate answare then you excu. this query...........................select TRUNC(SYSDATE) date to_char(SYSDATE 'day') day from DUAL order by to_char(TRUNC(SYSDATE)-1 'd')
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 10, 2006 04:15:06   #9  
vamsee krishna        

RE: How can we order the column of day (mon to sun)suc...

Hi Deepak

Could you please explain how the trunc(hire_date) will make the difference when you used it in the to_char for getting only the day of the week.

Thanks in advance.

-Vamsee


 
Is this answer useful? Yes | No
November 23, 2006 05:28:07   #10  
Girish        

RE: How can we order the column of day (mon to sun)suc...
select name hiredate to_char(hiredate 'day') from emp order by to_char(hiredate 'day') asc;
 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape