Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time Difference in Seconds using Netezza?

Tags:

sql

netezza

I want to Get time difference in minutes in Netezza in Seconds.

I have 2 columns: Start(2014-06-01 07:45:04) and finish(2014-06-01 07:46:58) events

I have tried Using DATEDIFF(SECOND,start,finish), but Netezza shoots an error.

Is there a function I am missing?

Select R.*,S.*,CM.URL,DATEDIFF(SECOND,R.EVENT_DTM,S.MIN) From CTE_1 R 
JOIN CTE_2 S
on S.VISIT_KEY = R.VISIT_KEY
JOIN ADMIN.VW_DIM_CME_METADATA CM on CM.CONTENT_METADATA_KEY = R.CONTENT_METADATA_KEY
like image 943
Alankar Avatar asked Dec 11 '22 05:12

Alankar


1 Answers

Did some Searching on the IBM forums and found this which works. If someone comes with better way please do post it. Thanks

    Select 
    R.*,S.*,CM.URL,
    EXTRACT(EPOCH from S.MIN - R.EVENT_DTM)DIFF 
    From CTE_1 R 
    JOIN CTE_2 S
    on S.VISIT_KEY = R.VISIT_KEY
    JOIN ADMIN.VW_DIM_CME_METADATA CM on CM.CONTENT_METADATA_KEY = R.CONTENT_METADATA_KEY
like image 199
Alankar Avatar answered Dec 27 '22 19:12

Alankar