daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Feb 21st, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select
  2.     count(*) as Callcount,
  3.     case
  4.        when datepart(mi, PBXqtime) < 30
  5.           then dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0)
  6.           else dateadd(mi, 30, dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0))
  7.     end as time
  8. from
  9.     callcomplete
  10. where
  11.     CustId = '3100472'
  12.     and PBXQTime between '11/1/11 0:0:00' and '11/30/11 23:59:00'
  13. group by
  14.     case
  15.        when datepart(mi, PBXqtime) < 30
  16.         then dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0)
  17.         else dateadd(mi, 30, dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0))
  18.     end
  19.    
  20. SELECT
  21.     DATEPART(DAY, pbxqtime) AS [day], DATEPART(HOUR, pbxqtime) AS [hour],
  22.     (DATEPART(MINUTE, pbxqtime) / 10) AS [interval], COUNT(*) AS Callcount
  23. FROM
  24.     callcomplete
  25. WHERE
  26.     custid = '3100472'
  27.     AND pbxqtime BETWEEN '11/1/11 0:0:00' AND '11/30/11 23:59:00'
  28. GROUP BY
  29.     DATEPART(DAY, pbxqtime), DATEPART(HOUR, pbxqtime),
  30.     (DATEPART(MINUTE, pbxqtime) / 10)
  31.    
  32. select
  33.     count(*) as Callcount,
  34.     DATEADD(minute,(DATEDIFF(minute,'20100101',PBXQTime) / 10)*10,'20100101')
  35. from
  36.     callcomplete
  37. where
  38.     CustId = '3100472'
  39.     and PBXQTime >= '20111101'
  40.     and PBXQTime < '20111201'
  41. group by
  42.     DATEADD(minute,(DATEDIFF(minute,'20100101',PBXQTime) / 10)*10,'20100101')
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