业务大佬给的Excel表需要求前三名的均值,Excel的函数这么写:=AVERAGE(LARGE($E$3:$E$17,{1,2,3}))Oracle我现在只会这么写:SELECT round(avg(a)) a_top3 from(SELECT a,dense_rank() over(order by a desc) rank1FROM table) WHERE rank1<=3有更简洁的SQL写法吗
比如我的SQL这样写:select {a} from sale,我传参 {a}=vip,SQL执行:select vip from sale。我另外还有一个字段 vip_avg,我的SQL应该怎么写,才能实现传参 vip,同时取出两个字段:vip,vip_avg。即最终效果为 select vip,vip_avg from sale 呢