4 Replies Latest reply: Dec 22, 2016 3:12 PM by Florian Brauburger RSS

    Split column into 2 when stop-date is in new month

    Florian Brauburger

      Hi all,

       

      I have the following datamodel:

       

      SQL SELECT
           ID
           STARTDATE,
           month(STARTDATE) as Month,
           STOPDATE,
           FAILUREID,
           FAILURENAME

       

      I want to calculate the sum of the time between STARTDATE and STOPDATE in one month. This is not the problem in one month.

      But when the STARTDATE and STOPDATE are in two different months, I only have the possibility of selecting data from the start month till endofmonth(STARTDATE).

       

      I don't know how to get data when I'm choosing the next month.

       

      One possibility would be splitting the record. But I don't know how to do that?

       

      Can you help me or give me another reason?

       

      Thanks a lot!

      Flo