我希望返回按每个分组的百分比,例如根据它们分组的有id_cerinta
多少subcerinteProiect
录音被acoperire= 'acoperita'
划分为所有录音subcerinteProiect
id_sarcina
我尝试了类似的东西:
SELECT
id_cerinta,
SUM(CASE WHEN acoperire = 'acoperita' THEN 1 ELSE 0 END)
/ COUNT(*) * 100 AS nr_subcerinte_acoperit
FROM
subcerinteProiect
GROUP BY
id_cerinta
但是效果不太好。它只返回 0..