Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- (CASE
- WHEN paymentDateTime > '2022-07-13 00:00:01' THEN 'AfterDeploy'
- WHEN paymentDateTime < '2022-07-11 23:59:59' THEN 'BeforeDeploy'
- ELSE 'DeployDay'
- END) as beforeAfterDeploy,
- count(DISTINCT userID),
- ROUND(SUM(paymentAmount)) revenue
- FROM
- payments p
- WHERE
- /*Put the number of days after the deploy. Use the max. number of days until the reporting day -1 from the deploy date*/
- paymentDateTime > DATE_SUB('2022-07-11', INTERVAL 78 DAY)
- AND paymentDateTime < DATE_ADD('2022-07-13', INTERVAL 78 DAY)
- AND paymentPeriod = 0
- GROUP BY
- beforeAfterDeploy
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement