Home » SQL & PL/SQL » SQL & PL/SQL » Diffference between two dates
Diffference between two dates [message #258847] Mon, 13 August 2007 11:53 Go to next message
avrillavinge
Messages: 98
Registered: July 2007
Member
How do i calculate difference between two consecutive dates

for eg:
My_Date

23-apr-2007
05-May-2007
06-jun-2007
16-jun-2007

I have to find diff between 2 consecutive dates for the above column.

Plz helpp ?
Re: Diffference between two dates [message #258852 is a reply to message #258847] Mon, 13 August 2007 11:57 Go to previous messageGo to next message
vamsi kasina
Messages: 2108
Registered: October 2003
Location: Hyderabad, India
Senior Member
I hope you are looking for the following.
Analytical Functions
Check LAG

By
Vamsi
Re: Diffference between two dates [message #258853 is a reply to message #258847] Mon, 13 August 2007 11:57 Go to previous messageGo to next message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
Could you please read the following two posts.

http://www.orafaq.com/forum/t/85036/94420/
http://www.orafaq.com/forum/t/59966/94420/

Regards

Raj
Re: Diffference between two dates [message #258856 is a reply to message #258847] Mon, 13 August 2007 11:59 Go to previous message
Bill B
Messages: 1662
Registered: December 2004
Senior Member
I assume that you want an order by my_date

select my_date - LAG(my_date,1,NULL) OVER (ORDER BY my_date) difference
from my_table
order by my_date;
Previous Topic: Find names containing letters (Merged)
Next Topic: Why is TRIGGER "not firing"?
Goto Forum:
  


Current Time: Sat Aug 19 21:16:42 CDT 2017

Total time taken to generate the page: 0.40388 seconds