Getting percentages for each day/category Using MySql 8.0, I have a table as below, and I'm trying to get the percentage of cancellations for each day.
| Request_at | Status              | Freq |
| ---------- | ------------------- | ---- |
| 2013-10-01 | completed           | 2    |
| 2013-10-01 | cancelled_by_client | 1    |
| 2013-10-02 | completed           | 2    |
| 2013-10-03 | completed           | 1    |
| 2013-10-03 | cancelled_by_driver | 1    |

How do I do so? The result should give:
| Date       | % cancel   |
| ---------- | -----------|
| 2013-10-01 |       0.33 |
| 2013-10-02 |       0.00 |
| 2013-10-03 |       0.50 |
SELECT Request_at AS `Date`, 
       SUM(CASE WHEN Status LIKE 'cancelled%'
                THEN Freq
                ELSE 0
                END) / SUM(Freq) AS `% cancel`
FROM source_table
GROUP BY Request_at