SHARE
TWEET

Untitled

a guest Jul 7th, 2017 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select
  2.   (
  3.            
  4.             select sum(abs(i1.time1 - i1.time2)) from mytable i1
  5.  
  6.  
  7.   ) -
  8.   sum(
  9.      
  10.     (if (i1.time2 < i2.time1, 0,
  11.         (if (i1.time1 < i2.time1 AND i1.time2 > i2.time2, abs(i2.time1 - i2.time2),
  12.                 if (i1.time1 < i2.time1 AND i1.time2 < i2.time2, abs(i1.time2 - i2.time1), 0))
  13.                 )
  14.       ))
  15.   )
  16.  
  17.   from mytable i1 join mytable i2 on i1.ID = i2.ID;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top