如何编写sql查询返回行只有列值超过列总和的1%,如
%sql select * from df1 where total_bytes>= 0.01*sum(total_bytes) order by total_bytes desc
但这给了我错误。
答案 0 :(得分:1)
使用子查询计算total_bytes
列的总和:
select *
from df1
where total_bytes >= 0.01*(select sum(total_bytes) from df1)
order by total_bytes desc