Alexander_89

m2

Sep 7th, 2025
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.55 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 SUM(net_revenue) AS total_net_revenue
  4. FROM
  5.     (SELECT pl.Player_ID, pl.First_deposit_date, pl.First_deposit_date + INTERVAL '30 days' AS date_new,  t1.Date,  t1.Net_Revenue
  6.     FROM Players AS pl
  7.     JOIN
  8.         (SELECT d.Player_ID, p.Date, d.Net_Revenue
  9.         FROM Daily_activity AS d
  10.         JOIN Periods AS p ON p.Date_ID=d.Date_ID) AS t1
  11.     ON t1.Player_ID=pl.Player_ID
  12.     WHERE pl.Country = 'Brazil') AS t2
  13. WHERE Date BETWEEN First_deposit_date AND date_new;
Advertisement
Add Comment
Please, Sign In to add comment