Guest User

Real query

a guest
Sep 15th, 2021
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "pg" (31 ms)
  2.  
  3.     SELECT what, amount, gamemode, date, champion_id, id, result
  4.     FROM
  5.     (
  6.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'kills' AS what, kills AS amount, row_number() over (ORDER BY kills DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  7.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  8.  
  9.       UNION ALL
  10.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'deaths' AS what, deaths AS amount, row_number() over (ORDER BY deaths DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  11.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  12.  
  13.       UNION ALL
  14.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'assists' AS what, assists AS amount, row_number() over (ORDER BY assists DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  15.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  16.  
  17.       UNION ALL
  18.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'gold' AS what, gold AS amount, row_number() over (ORDER BY gold DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  19.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  20.  
  21.       UNION ALL
  22.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'minions' AS what, minions AS amount, row_number() over (ORDER BY minions DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  23.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  24.  
  25.       UNION ALL
  26.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'kda' AS what, kda AS amount, row_number() over (ORDER BY kda DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  27.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  28.  
  29.       UNION ALL
  30.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'damage_taken' AS what, damage_taken AS amount, row_number() over (ORDER BY damage_taken DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  31.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  32.  
  33.       UNION ALL
  34.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'damage_dealt_champions' AS what, damage_dealt_champions AS amount, row_number() over (ORDER BY damage_dealt_champions DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  35.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  36.  
  37.       UNION ALL
  38.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'damage_dealt_objectives' AS what, damage_dealt_objectives AS amount, row_number() over (ORDER BY damage_dealt_objectives DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  39.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  40.  
  41.       UNION ALL
  42.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'kp' AS what, kp AS amount, row_number() over (ORDER BY kp DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  43.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  44.  
  45.       UNION ALL
  46.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'vision_score' AS what, vision_score AS amount, row_number() over (ORDER BY vision_score DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  47.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  48.  
  49.       UNION ALL
  50.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'critical_strike' AS what, critical_strike AS amount, row_number() over (ORDER BY critical_strike DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  51.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  52.  
  53.       UNION ALL
  54.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'time_spent_living' AS what, time_spent_living AS amount, row_number() over (ORDER BY time_spent_living DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  55.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  56.  
  57.       UNION ALL
  58.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'heal' AS what, heal AS amount, row_number() over (ORDER BY heal DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  59.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  60.  
  61.       UNION ALL
  62.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'turret_kills' AS what, turret_kills AS amount, row_number() over (ORDER BY turret_kills DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  63.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  64.  
  65.       UNION ALL
  66.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'killing_spree' AS what, killing_spree AS amount, row_number() over (ORDER BY killing_spree DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  67.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  68.  
  69.       UNION ALL
  70.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'double_kills' AS what, double_kills AS amount, row_number() over (ORDER BY double_kills DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  71.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  72.  
  73.       UNION ALL
  74.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'triple_kills' AS what, triple_kills AS amount, row_number() over (ORDER BY triple_kills DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  75.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  76.  
  77.       UNION ALL
  78.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'quadra_kills' AS what, quadra_kills AS amount, row_number() over (ORDER BY quadra_kills DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  79.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  80.  
  81.       UNION ALL
  82.       SELECT match_teams.result AS result, matches.id AS id, date, gamemode, champion_id, 'penta_kills' AS what, penta_kills AS amount, row_number() over (ORDER BY penta_kills DESC) AS rn FROM match_players INNER JOIN matches ON matches.id = match_players.match_id INNER JOIN match_teams ON match_players.match_id = match_teams.match_id AND match_players.team = match_teams.color WHERE match_players.summoner_puuid = 'EdlDRRAPVUAYf9iDPF9iKNyF-6rkpnXXBLiF4VUfcPYZXV9xaiQsgGKiaIz4IgBX3JCiL_oS5fmXAQ'
  83.       AND match_teams.result != 'Remake' AND matches.gamemode NOT IN (800, 810, 820, 830, 840, 850, 2000, 2010, 2020)
  84.  
  85.     ) all_candidates
  86.     WHERE rn = 1;
Advertisement
Add Comment
Please, Sign In to add comment