I wish to return a percentage grouped by each id_cerinta, like how many of the subcerinteProiect recordings are having acoperire= 'acoperita' divided to all the subcerinteProiect recordings according to the id_sarcina they are grouped by

I tried something like :
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
But it doesn’t work too good. It returns only 0..
This is due to integer math. Try these:
Results are all 0.
Now try:
Better results, right?
So for your query: