Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- In all requests I change in names of tables and names of columns " " -> "_" (for example Bet ID -> Bet_ID)
- -- 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.
- -- 1.
- SELECT SUM(Bet_amount)
- FROM
- (SELECT b.Player_ID, b.Bet_amount, p.Date
- FROM Bets_transactions AS b
- JOIN Periods AS p ON b.Date_ID=p.Date_ID
- WHERE p.Date = '2018-01-01') AS t1
- WHERE Bet_amount > 1;
- -- 2.
- SELECT COUNT(Bet_amount)
- FROM
- (SELECT b.Player_ID, b.Bet_amount, p.Date
- FROM Bets_transactions AS b
- JOIN Periods AS p ON b.Date_ID=p.Date_ID
- WHERE p.Date = '2018-01-01') AS t1
- WHERE Bet_amount > 1;
Advertisement
Add Comment
Please, Sign In to add comment