Oracle-子查询与分析函数查询 [英] Oracle - Subquery vs Analytical Function Query

查看:93
本文介绍了Oracle-子查询与分析函数查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

-- One
select * from
(select
    employeeid, effectivedate, designationid,
    max(effectivedate) over (partition by employeeid) meffectivedate    
from
    designationtransfers
) where effectivedate = meffectivedate

-- Two
select employeeid, effectivedate, designationid from
	designationtransfers t
where 
	effectivedate = 
		(select max(effectivedate) from designationtransfers t1 where t.employeeid = t1.employeeid)



上面两个查询的结果是相同的.但是,我不确定哪个是要使用的,哪个要优于另一个.

有人可以帮我吗?

预先谢谢您.



The result of the above two queries is the same. But, I am uncertain which is the one to use and which is better than the other.

Can anybody help me?

Thank you in advance.

推荐答案

好,我个人是.NET和SQL Server用户,我想说第二个,因为我非常熟悉那里的代码.我求求不同!
ok being a .NET and SQL Server user personally, I would say the 2nd one because Im much familiar with the code there..but I beg to differ!


这篇关于Oracle-子查询与分析函数查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆