条形图-https://help.fanruan.com/finereport/doc-view-3361.html
select
apply_name as 员工姓名,
sum(total_amount) as 报销金额,
traffic_type as 交通工具
from
m_business_traffic
where apply_name in (select t.apply_name from (select t.apply_name,t.总额, row_number() over(order by 总额 desc) rn from (select apply_name,sum(total_amount) as 总额 from m_business_traffic group by apply_name) t ) t where rn <= 10)
group by apply_name,traffic_type
~~~~~~~~~~~~~~~
select a.*
from
(
select t1.*,(select count(*)+1 from 表 where 分组字段=t1.分组字段 and 排序字段<t1.排序字段) as group_id
from 表 t1
) a
where a.group_id<=3 # 假设取前3条