我想按类型(M 或 C)显示给定用户的百分比,我尝试使用此查询:
SELECT TYPE,user_name,pourcentage_c,pourcentage_m,id_user,
COUNT(TYPE) AS crtitique ,COUNT(TYPE) AS majeur
FROM stat_alert
LEFT OUTER JOIN user_qdf ON user_qdf.`id` = id_user
WHERE user_qdf.`id`=id_user AND TYPE='C'
GROUP BY id_user
UNION ALL
SELECT TYPE,user_name,pourcentage_c,pourcentage_m,id_user,
COUNT(TYPE) AS crtitique,COUNT(TYPE) AS majeur
FROM stat_alert
LEFT OUTER JOIN user_qdf ON user_qdf.`id` = id_user
WHERE user_qdf.`id`=id_user AND TYPE='M'
GROUP BY id_user
我想在同一行显示单个用户的关键和重要的百分比和数量