我需要组并获得百分比真正的完成了MySQL查询
id type completed
1 4 true
2 4 false
3 3 false
4 5 true
5 5 true
结果
type completed
4 %50
3 %0
5 %100
尝试使用有条件聚集:
SELECT
type,
100.0 * AVG(completed = 'true') AS completed
FROM yourTable
GROUP BY
type;