Advertisement
NatedogServer

Character Plat

Nov 13th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.39 KB | None | 0 0
  1. -- Go ahead and force read uncommited so we do not lock player tables while users are playing...
  2. SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
  3.  
  4. SELECT * FROM (
  5.     SELECT
  6.         ACCOUNT_ID
  7.         , ACC.NAME AS ACCOUNT_LOGIN
  8.         , CHARACTER_ID
  9.         , CHARACTER_NAME
  10.         ,
  11.             PLAYER_PLATINUM + BANK_PLATINUM + CURSOR_PLATINUM
  12.             + (PLAYER_GOLD + BANK_GOLD + CURSOR_GOLD) / 10
  13.             + (PLAYER_SILVER + BANK_SILVER + CURSOR_SILVER) / 100
  14.             + (PLAYER_COPPER + BANK_COPPER + CURSOR_COPPER) / 1000 AS CHARACTER_NET_WORTH_IN_PLAT
  15.     FROM
  16.         (
  17.             SELECT
  18.                 CD.ID AS CHARACTER_ID
  19.                 ,CD.NAME AS CHARACTER_NAME
  20.                 ,CD.ACCOUNT_ID
  21.                
  22.                 /* Player Platinum! */
  23.                 ,CC.platinum AS PLAYER_PLATINUM
  24.                 ,CC.gold AS PLAYER_GOLD
  25.                 ,CC.silver AS PLAYER_SILVER
  26.                 ,CC.copper AS PLAYER_COPPER
  27.                
  28.                 /* Bank Platinum */
  29.                 ,CC.platinum_bank AS BANK_PLATINUM
  30.                 ,CC.gold_bank AS BANK_GOLD
  31.                 ,CC.silver_bank AS BANK_SILVER
  32.                 ,CC.copper_bank AS BANK_COPPER
  33.                
  34.                 /* Cursor Platinum */
  35.                 ,CC.platinum_cursor AS CURSOR_PLATINUM
  36.                 ,CC.gold_cursor AS CURSOR_GOLD
  37.                 ,CC.silver_cursor AS CURSOR_SILVER
  38.                 ,CC.copper_cursor AS CURSOR_COPPER
  39.              
  40.             FROM character_data CD
  41.             INNER JOIN character_currency CC ON CC.id = CD.id
  42.         ) IndividualCharacterSlots
  43.         INNER JOIN ACCOUNT ACC
  44.             ON ACC.ID = IndividualCharacterSlots.ACCOUNT_ID
  45. ) Details
  46. ORDER BY CHARACTER_NET_WORTH_IN_PLAT DESC
  47. LIMIT 100;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement