SQL Language (MOSC)

MOSC Banner

calculate sum of overlapping dates

edited Aug 5, 2018 2:39AM in SQL Language (MOSC) 5 commentsAnswered ✓

if we have these data :

   1    1/1/2018 13:00           1/1/2018 13:30

   2    1/1/2018 13:10           1/1/2018 13:45

   3    1/1/2018 13:20           1/1/2018 14:00

   4    1/1/2018 15:00           1/1/2018 15:30

if we want to calculate sum duration

   1    1/1/2018 13:00           1/1/2018 13:30     30

   2    1/1/2018 13:10           1/1/2018 13:45     35

   3    1/1/2018 13:20           1/1/2018 14:00     40

   4    1/1/2018 15:00           1/1/2018 15:30     30

so sum duration is : 135

but this result is wrong because we have overlapping date

   1    1/1/2018 13:00           1/1/2018 13:30     30

   2    1/1/2018 13:10           1/1/2018 13:45     15

   3    1/1/2018 13:20           1/1/2018 14:00     15

   4    1/1/2018 15:00           1/1/2018 15:30     30

so sum duration is : 90

this is correct result.

how i solve this issue ?

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