Sandbird

Per month cases/deaths based on total values

Jul 1st, 2022 (edited)
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.32 KB | None | 0 0
  1. SELECT
  2. DATE_FORMAT(B.date, '%b/%Y') DD,
  3. (B.confirmed - A.confirmed) + (B.total_reinfections - A.total_reinfections) as cases_with_reinfections,
  4. (B.total_deaths - A.total_deaths) as deaths
  5. FROM cases A INNER JOIN cases B
  6. ON A.date = LAST_DAY(B.date - interval 1 month) and B.date = LAST_DAY(B.date)  
  7. ORDER BY B.date DESC
Add Comment
Please, Sign In to add comment