数量÷总数×100=百分比
SELECT user_id ,COUNT(*) total,
CONCAT(CAST(CONVERT(100 * CAST(count(*) AS DECIMAL) / CAST((SELECT COUNT(*) FROM 表名) AS DECIMAL), DECIMAL) AS CHAR) ,'%') AS percentage
FROM 表名 WHERE GROUP BY user_id
数量÷总数×100=百分比
SELECT user_id ,COUNT(*) total,
CONCAT(CAST(CONVERT(100 * CAST(count(*) AS DECIMAL) / CAST((SELECT COUNT(*) FROM 表名) AS DECIMAL), DECIMAL) AS CHAR) ,'%') AS percentage
FROM 表名 WHERE GROUP BY user_id