Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
-- 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.
Posted
Updated 27-Aug-10 7:53am
v3

1 solution

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!
 
Share this answer
 
Comments
Ravi LVS 30-Aug-10 22:59pm    
I would like to say whether the coding is difficult to understand or not, but performance-wise it must be good option over other. Anyway, thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900