SHARE
TWEET

Untitled

a guest Jul 7th, 2017 143 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select
  2.   sum(
  3.     abs(i1.time1 - i1.time2)
  4.     - (if (i1.time2 < i2.time1, 0,
  5.         (if (i1.time1 < i2.time1 AND i1.time2 > i2.time2, abs(i2.time1 - i2.time2),
  6.                 if (i1.time1 < i2.time1 AND i1.time2 < i2.time2, abs(i1.time2 - i2.time1), 0))
  7.                 )
  8.       ))
  9.   )
  10.  
  11.   from mytable i1 join mytable i2 limit 1000;
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