SQL Language (MOSC)

MOSC Banner

Substract two timestamps and get result in days, hours, minutes

in SQL Language (MOSC) 2 commentsAnswered ✓

I want to create a view as result substract two timestamps in days, hours, minutes and multiple column_names. As test I made a query like this :

select id, formingline, mouldnr, (CAST(stoptime as timestamp) - CAST(starttime as timestamp)) as diff from slr_logmould;

Then I make this query :

select extract (Day from diff) As Days, extract (Hour from diff) As Hours, extract (Minute from diff) As Minutes from (select id, formingline, mouldnr, (CAST(stoptime as timestamp) - CAST(starttime as timestamp)) as diff from slr_logmould);

Result :

Could somebody give me advice, what i do wrong, because I want the result include with the other column names.

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center