I have a dataset I can group and want to know the percentage of rows in each group.
This seems to nearly works, except that it returns 0 for every group because of imho missing typecast
SELECT COUNT(*) / (SELECT COUNT(name)
FROM x
WHERE d = '0')
FROM x, y
WHERE x.a = y.a AND x.b = '0'
GROUP BY y.c
ORDER BY y.c ASC
How do I correctly cast this?