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: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
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: 1482
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: why oracle writes first redolog after commit was issued?
Next Topic: How to see all the tables create by me?
Goto Forum:
  


Current Time: Sun Dec 04 08:32:02 CST 2016

Total time taken to generate the page: 0.04390 seconds