统计专线公司某时间段票均(该时间段所有开单总费用的和/开单数)<= xxx元(条件、排序)
专线公司(specialtyType = 4)
开单总费用(FEE_TOTAL)
开单数(select count(1) from bi_t_ope_order where CREATE_TIME between '${开始时间}' and '${结束时间}' and specialtyType = 4)
如何合并在一个sql查询中得出结果
select compname,sum(FEE_TOTAL) as s_FEE_TOTAL,count(1) as s_count from tabname where specialtyType = 4 group by compname HAVING sum(FEE_TOTAL)/count(1) <= 1000