Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. SELECT COUNT (DISTINCT e.to_name)
  2. FROM APD.Events_Analysis e
  3. WHERE e.type_id in (149,150)
  4.  
  5. select trace_id,sum(sum1)
  6. from
  7. (
  8. select distinct b.trace_id,
  9. case when b.behavior_type_id=12031 then 15
  10. when b.behavior_type_id=12010 then 5
  11. when b.behavior_type_id=12006 then 5
  12. when b.behavior_type_id=11051 then 3
  13. when b.behavior_type_id=11047 then 2
  14. when b.behavior_type_id=11046 then 2
  15. when b.behavior_type_id=11045 then 0
  16. when b.behavior_type_id=11044 then 1
  17. when b.behavior_type_id=11043 then 0
  18. when b.behavior_type_id=11042 then 5
  19. when b.behavior_type_id=11041 then 0
  20. when b.behavior_type_id=11039 then 15
  21. when b.behavior_type_id=11038 then 10
  22. when b.behavior_type_id=11036 then 4
  23. when b.behavior_type_id=11031 then 3
  24. when b.behavior_type_id=11029 then 3
  25. when b.behavior_type_id=11028 then 0
  26. when b.behavior_type_id=11027 then 0
  27. when b.behavior_type_id=11025 then 0
  28. when b.behavior_type_id=11023 then 0
  29. when b.behavior_type_id=11019 then 0
  30. when b.behavior_type_id=11017 then 0
  31. when b.behavior_type_id=11016 then 0
  32. when b.behavior_type_id=11015 then 0
  33. when b.behavior_type_id=11012 then 0
  34. when b.behavior_type_id=11011 then 0
  35. when b.behavior_type_id=11008 then 0
  36. when b.behavior_type_id=11007 then 4
  37. when b.behavior_type_id=11005 then 8
  38. when b.behavior_type_id=11002 then 3
  39. when b.behavior_type_id=3810 then 15
  40. when b.behavior_type_id=3808 then 15
  41. when b.behavior_type_id=3807 then 15
  42. when b.behavior_type_id=3806 then 7
  43. when b.behavior_type_id=3805 then 8
  44. when b.behavior_type_id=3802 then 3
  45. when b.behavior_type_id=2075 then 0
  46. when b.behavior_type_id=2061 then 5
  47. when b.behavior_type_id=2054 then 5
  48. when b.behavior_type_id=2038 then 7
  49. when b.behavior_type_id=2035 then 3
  50. when b.behavior_type_id=2034 then 3
  51. when b.behavior_type_id=2032 then 3
  52. when b.behavior_type_id=2031 then 4
  53. when b.behavior_type_id=2030 then 3
  54. when b.behavior_type_id=2029 then 3
  55. when b.behavior_type_id=2023 then 0
  56. when b.behavior_type_id=2017 then 1
  57. when b.behavior_type_id=2015 then 1
  58. when b.behavior_type_id=2007 then 3
  59. when b.behavior_type_id=2000 then 6
  60. when b.behavior_type_id=1146 then 5
  61. when b.behavior_type_id=1117 then 0
  62. when b.behavior_type_id=1099 then 0
  63. when b.behavior_type_id=1098 then 0
  64. when b.behavior_type_id=1096 then 0
  65. when b.behavior_type_id=1094 then 0
  66. when b.behavior_type_id=1090 then 0
  67. when b.behavior_type_id=1089 then 0
  68. when b.behavior_type_id=1087 then 0
  69. when b.behavior_type_id=1086 then 0
  70. when b.behavior_type_id=1083 then 0
  71. when b.behavior_type_id=1080 then 0
  72. when b.behavior_type_id=1078 then 0
  73. when b.behavior_type_id=1077 then 0
  74. when b.behavior_type_id=1056 then 15
  75. when b.behavior_type_id=1045 then 0
  76. when b.behavior_type_id=1043 then 0
  77. when b.behavior_type_id=1041 then 10
  78. when b.behavior_type_id=1027 then 0
  79. when b.behavior_type_id=1005 then 0
  80. else
  81. 0 end as sum1
  82. from apd.TracesToBehaviors b
  83. ) v
  84. group by trace_id
  85. order by 2 desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement