Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. SELECT
  2. (
  3. IFNULL(LOG(1.5, cashearned),0) +
  4. IFNULL(LOG(1.3, roundswon), 0) +
  5. (
  6. SELECT COUNT(*)
  7. FROM achievements_new
  8. WHERE `value` = -1 AND achievements_new.id = playerdata.id
  9. )
  10. ) as rank,
  11. nationality,
  12. nick,
  13. steamid64,
  14. cash,
  15. playtime,
  16. damage,
  17. destroyed,
  18. (
  19. SELECT SUM(price)
  20. FROM weaponprices
  21. WHERE weapon IN
  22. (
  23. SELECT class
  24. FROM playerweapons
  25. WHERE playerweapons.id = playerdata.id
  26. )
  27. ) as wepvalue,
  28. (
  29. SELECT COUNT(*)
  30. FROM achievements_new
  31. WHERE `value` = -1 AND achievements_new.id = playerdata.id
  32. ) as achcount,
  33. lastplayed
  34. FROM playerdata
  35. ORDER BY rank DESC
  36.  
  37. CREATE TABLE IF NOT EXISTS `playerdata` (
  38. `id` int(11) unsigned NOT NULL,
  39. `steamid64` char(17) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
  40. `nick` varchar(32) NOT NULL DEFAULT '',
  41. `cash` int(32) unsigned NOT NULL DEFAULT '0',
  42. `playtime` int(32) unsigned NOT NULL DEFAULT '0',
  43. `nationality` char(2) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
  44. `damage` int(32) unsigned NOT NULL DEFAULT '0',
  45. `destroyed` int(32) unsigned NOT NULL DEFAULT '0',
  46. `cashearned` int(10) unsigned NOT NULL,
  47. `roundswon` smallint(5) unsigned NOT NULL,
  48. `lastplayed` datetime NOT NULL,
  49. ) ENGINE=InnoDB
  50.  
  51. CREATE TABLE IF NOT EXISTS `achievements_new` (
  52. `id` int(10) unsigned NOT NULL,
  53. `achkey` enum(<snip - lots of values here>) NOT NULL,
  54. `value` mediumint(8) NOT NULL DEFAULT '0'
  55. ) ENGINE=InnoDB
  56.  
  57. CREATE TABLE IF NOT EXISTS `playerweapons` (
  58. `id` int(10) unsigned NOT NULL,
  59. `class` varchar(30) CHARACTER SET ascii NOT NULL
  60. ) ENGINE=InnoDB
  61.  
  62. CREATE TABLE IF NOT EXISTS `weaponprices` (
  63. `weapon` varchar(30) NOT NULL,
  64. `price` int(10) unsigned NOT NULL
  65. ) ENGINE=InnoDB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement