Advertisement
festinko

Untitled

Sep 29th, 2022
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.58 KB | None | 0 0
  1. SELECT
  2.     (CASE
  3.     WHEN paymentDateTime > '2022-07-13 00:00:01' THEN 'AfterDeploy'
  4.     WHEN paymentDateTime < '2022-07-11 23:59:59' THEN 'BeforeDeploy'
  5.     ELSE 'DeployDay'
  6.     END) as beforeAfterDeploy,
  7.     count(DISTINCT userID),
  8.     ROUND(SUM(paymentAmount)) revenue
  9.    
  10. FROM
  11.     payments p
  12.    
  13. WHERE
  14. /*Put the number of days after the deploy. Use the max. number of days until the reporting day -1 from the deploy date*/
  15.  
  16. paymentDateTime > DATE_SUB('2022-07-11', INTERVAL 78 DAY)
  17. AND paymentDateTime < DATE_ADD('2022-07-13', INTERVAL 78 DAY)
  18.  
  19.  
  20. AND paymentPeriod = 0
  21.  
  22. GROUP BY
  23.     beforeAfterDeploy
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement