Alexander_89

m31

Sep 7th, 2025
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.43 KB | None | 0 0
  1. -- In all requests I change in names of tables and names of columns " " -> "_" (for example  Bet ID -> Bet_ID)
  2.  
  3. SELECT Player_ID, Bet_amount
  4. FROM
  5.     (SELECT Player_ID, Bet_amount, ROW_NUMBER() OVER (PARTITION BY Player_ID ORDER BY Bet_amount DESC) AS rk
  6.     FROM
  7.         (SELECT b.Player_ID, b.Bet_amount, p.Date
  8.         FROM Bets_transactions AS b
  9.         JOIN Periods AS p ON b.Date_ID=p.Date_ID
  10.         WHERE p.Date = '2018-01-01') AS t1) AS t2
  11. WHERE rk=2;
  12.  
Advertisement
Add Comment
Please, Sign In to add comment