选择PostgreSQL中另一列的百分比

我想按avfamily分组,选择具有非居住地价值等于true的记录数量,并将其返回为perc值。

本质上,第3栏除以第2栏乘以100。

select 

    avclassfamily, 
    count(distinct(malware_id)) as cc, 
    sum(case when livingofftheland = 'true' then 1 else 0 end),  
    (100.0 *  (sum(case when livingofftheland = 'true' then 1 else 0 end)  / (count(*)) ) )  as perc 
from malwarehashesandstrings 
group by avclassfamily  having count(*) > 5000  
order by perc desc;

可能很简单,但是我的大脑在这里空白。