Question: Still not producing right count SELECT category, COUNT(DISTINCT T1.report_id) AS count, ROUND(AVG( CASE prison_time_unit WHEN 'Months' THEN T2.prison_time * 30 WHEN 'Years' THEN T2.prison_time *

Still not producing right count SELECT category, COUNT(DISTINCT T1.report_id) AS count, ROUND(AVG( CASE prison_time_unit WHEN 'Months' THEN T2.prison_time * 30 WHEN 'Years' THEN T2.prison_time * 365 WHEN 'Weeks' THEN T2.prison_time * 7 ELSE T2.prison_time END ), 2) AS avg_prison_time_days FROM incidents AS T1 INNER JOIN outcomes AS T2 ON T1.report_id = T2.report_id WHERE T2.prison_time IS NOT NULL AND T2.prison_time > 0 GROUP BY category HAVING count > 50 ORDER BY avg_prison_time_days DESC

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!