the query that you have shown doesn't look anything like the ratings tables
also, you cannot "select star" at the same time as using a GROUP BY
if you don't want to count zeros, here's the way you do it --
Code:
select sum(case when foo = 0 then 0 else 1 end) as non_zero_counts from ...