Flag Rate per Post
Medium
Blog Comments & Moderation
For each post return the percentage of its comments that are flagged, rounded to 1 decimal. Order by the rate descending, then post_id.
Table schema
Comments(comment_id INT PRIMARY KEY, post_id INT, user_id INT, created_at DATETIME, flagged INT)Sample data
Comments
comment_id | post_id | user_id | created_at | flagged
1 | 10 | 1 | 2026-05-01 09:00 | 0
2 | 10 | 2 | 2026-05-01 09:30 | 1
3 | 10 | 2 | 2026-05-01 10:00 | 1
4 | 11 | 3 | 2026-05-02 08:00 | 0
5 | 11 | 1 | 2026-05-02 08:10 | 0
6 | 12 | 2 | 2026-05-03 12:00 | 1
7 | 12 | 3 | 2026-05-03 11:00 | 0
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.