Sadly adding a column is not possible for 2 reasons, I don't have admin access and is a validated enviroment.
I'm not clear with what you mean by:
"...try to create exactly the input you need with formula."
I'm not really used to DB2. I get this from a Crystal Report's report. Using a viewer it defines this field as @Elapsed time which get the results I showed.
Here's what I've managed to do (from
http://www-128.ibm.com/developerwork...211yip3.html):
Code:
CREATE FUNCTION secondsdiff(t1 TIMESTAMP, t2 TIMESTAMP)
RETURNS INT
RETURN (
(DAYS(t1) - DAYS(t2)) * 86400 +
(MIDNIGHT_SECONDS(t1) - MIDNIGHT_SECONDS(t2))
)
And my new query:
Code:
SELECT secondsdiff(A.DEPT_TIMESTAMP,B.DEPT_TIMESTAMP)/86400 as elapsed_days,
(secondsdiff(A.DEPT_TIMESTAMP,B.DEPT_TIMESTAMP)-((secondsdiff(A.DEPT_TIMESTAMP,B.DEPT_TIMESTAMP)/86400)*86400))/3600 as elapsed_hours
FROM BAX_DEPT_SCHED_LG A,BAX_DEPT_SCHED_LG B WHERE
A.BATCH_ID = B.BATCH_ID AND B.REASON = ''
AND A.REASON ='MFG VERIFICATION' AND B.BATCH_ID ='UR295881'
And the result:
Code:
ELAPSED_DAYS ELAPSED_HOURS
95 22
I went for the mins/sec part but the query became way too complicated and never pulled it of.
Maybe someone out there has a better way or can pull it off in a more elegant way.
Thanks in advance.