大佬教程收集整理的这篇文章主要介绍了select over partiton by ... order by .. 使用了很长时间,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
select a.id
from (SELEct /*+index(test_table,test_indeX)*/
row_number() over (partition by a,b,c order by d desc) rn,ID
from test_table
) a
where a.rn = 1
test_index(a,c,d)
limit access to 500,cost 9s)
我该如何解决
出于好奇,使用相关子查询需要多长时间?
SELEct t.id
from test_table t
where t.d = (SELEct max(t2.d)
from test_table t2
where t2.a = t.a and t2.b = t.b and t2.c = t.c
);
还是使用聚合?
SELEct max(t.id) keep (dense_rank first order by d desc)
from test_table t
group by a,b,c;
以上是大佬教程为你收集整理的select over partiton by ... order by .. 使用了很长时间全部内容,希望文章能够帮你解决select over partiton by ... order by .. 使用了很长时间所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。