select store_code,
count(*) "总单数",
sum(case when so.paid_amount>300 then 1 else 0 end ) as "大于300的订单数",
sum(so.paid_amount>300) as "=》大于300的订单数",
sum(case when so.paid_amount>300 then 1 else 0 end ) / count(*) as "大于300的订单占比",
avg(so.paid_amount>300) as "大于300的订单占比2",
sum(so.paid_amount) as "销售总额"
from sales_order so
group by store_code order by store_code