cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi,

I need to calculate the Wrench Time for a Breakdown Duration from Status of Breakdown Notification from table JCDS.

The data in JCDS table is

i have used SQL Script Procedure to calculate the changes from one status to the other status and the output i'm getting is like below.

I'm not able to club the values as per the Notification Number and below is the code i used.

SELECT NOTIFNO, OBJECT, ENRDUR, MHMDUR, MHSDUR, MHPDUR, MHODUR, MHJDUR, MHRDUR, NODUR

        FROM   :SQL_STATUS_ENR

        UNION

        SELECT NOTIFNO, OBJECT, ENRDUR, MHMDUR, MHSDUR, MHPDUR, MHODUR, MHJDUR, MHRDUR, NODUR

        FROM   :SQL_STATUS_MHM

        UNION

        SELECT NOTIFNO, OBJECT, ENRDUR, MHMDUR, MHSDUR, MHPDUR, MHODUR, MHJDUR, MHRDUR, NODUR

        FROM   :SQL_STATUS_MHS

        UNION

        SELECT NOTIFNO, OBJECT, ENRDUR, MHMDUR, MHSDUR, MHPDUR, MHODUR, MHJDUR, MHRDUR, NODUR

        FROM   :SQL_STATUS_MHP

        UNION

        SELECT NOTIFNO, OBJECT, ENRDUR, MHMDUR, MHSDUR, MHPDUR, MHODUR, MHJDUR, MHRDUR, NODUR

        FROM   :SQL_STATUS_MHO

        ORDER BY NOTIFNO, OBJECT;

Can anyone suggest me how to club the values as per Notification into a single row.

Regards,

Ramana.

View Entire Topic
vivekbhoj
Active Contributor
0 Likes

Hi Ramana,

From your code, it seems you are using UNION and not UNION ALL

Try UNION ALL and then check again.

Regards,

Vivek