====>>>>> I've moved to http://shallowhacker.blogspot.com

Monday, July 25

Another success story

Here’s how to find the difference between two dates in SQL

The difference can be displayed in seconds minutes or hours depending on the upper('??') bit which you can fill with ss, mm, or hh

 

--  FIND DIF BETWEEN TWO DATES IN SECONDS ('SS') MINUTES ('MI') or HOURS ('HH')

select ( sysdate - (select MIN(DATE_UPDATED) from BILLING_TRANSACTIONS_REQ) ) -- FIND DIFFERENCE BETWEEN TWO DATES

       * decode(upper('ss'),'SS',24*60*60,'MI',24*60,'HH',24,NULL)            -- DECODE DATE DIFFERENCE

from dual

 

===

JD

No comments:

gigajosh.blogspot.com has moved to http://shallowhacker.blogspot.com

Hi, I recently moved to http://hallowhacker.blogspot.com so please come and find me there if you want to see my latest posts :-)

HTC TYTN II internet price graph

HTC TYTN II internet price graph

tracker

eXTReMe Tracker