Report: weeks between birth and death
Jump to navigation
Jump to search
Description: Individuals: frequency distribution of difference (in "absolute" weeks) between day/month of birth and day/month of death
Copy and paste the text between the lines into the reports section below "OR Leave Display, Criteria and Sort fields blank and enter direct SQL SELECT statement here:" and give it the title you think is appropriate
SELECT IF(ABS(WEEK(deathdatetr,3)-WEEK(birthdatetr,3)) < 27, ABS(WEEK(deathdatetr,3)-WEEK(birthdatetr,3)),53-ABS(WEEK(deathdatetr,3)-WEEK(birthdatetr,3))) AS Diffence_in_weeks, COUNT(*) AS Amount, RPAD(' ',COUNT(*)/5,'=') AS Graphik FROM tng_people WHERE DAYOFYEAR(birthdatetr)<>0 AND DAYOFYEAR(deathdatetr)<>0 GROUP BY Diffence_in_weeks ORDER BY Diffence_in_weeks