Sandbird

Per month cases/deaths based on total values

Jul 1st, 2022 (edited)
263
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data Copied