tubelius

Prism % of blocks broken

Apr 12th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. select
  2. bl.player as PlayerName
  3. , bl.block_id as BlockId
  4. , bl.BrokenNet/tot.BrokenNet*100 as PercentOfAllBlocks
  5. , bl.BrokenNet as TheseBlocks
  6. , tot.BrokenNet as TotalBlocks
  7. from (
  8. SELECT
  9. PA.`player`
  10. , PA.`block_id`
  11. , sum(case when PA.`action_type`='block-break' then 1 else 0 end)
  12. -sum(case when PA.`action_type`='block-place' then 1 else 0 end) as BrokenNet
  13. from `prism_actions` as PA
  14. where PA.`action_type` in ('block-break','block-place')
  15. and PA.player not in ('','tnt','creeper')
  16. group by
  17. PA.`player`
  18. , PA.`block_id`
  19. having sum(case when PA.`action_type`='block-break' then 1 else 0 end)
  20. -sum(case when PA.`action_type`='block-place' then 1 else 0 end)>0
  21. ) as bl
  22. inner join (
  23. SELECT
  24. PA.`player`
  25. , sum(case when PA.`action_type`='block-break' then 1 else 0 end)
  26. -sum(case when PA.`action_type`='block-place' then 1 else 0 end) as BrokenNet
  27. from `prism_actions` as PA
  28. where PA.`action_type` in ('block-break','block-place')
  29. group by
  30. PA.`player`
  31. having sum(case when PA.`action_type`='block-break' then 1 else 0 end)
  32. -sum(case when PA.`action_type`='block-place' then 1 else 0 end)>0
  33. ) as tot
  34. on tot.player = bl.player
  35. order by PercentOfAllBlocks desc
  36. ;
Advertisement
Add Comment
Please, Sign In to add comment