Alexander_89

m32

Sep 7th, 2025
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.67 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. -- It is not completely clear, what does "total bets" mean: the sum of bets or the amount of bets, so I give requests for both cases.
  3.  
  4. -- 1.
  5. SELECT SUM(Bet_amount)
  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
  11. WHERE Bet_amount > 1;
  12.  
  13. -- 2.
  14. SELECT COUNT(Bet_amount)
  15. FROM
  16.     (SELECT b.Player_ID, b.Bet_amount, p.Date
  17.     FROM Bets_transactions AS b
  18.     JOIN Periods AS p ON b.Date_ID=p.Date_ID
  19.     WHERE p.Date = '2018-01-01') AS t1
  20. WHERE Bet_amount > 1;
  21.  
Advertisement
Add Comment
Please, Sign In to add comment