Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Is this Odd SQL statement optimized?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-18 : 08:23:28
Tim writes "BackGround: This statement is used to select the maximum row, based on date, out of a table containing mulitple rows with the same foreign key.


SELECT E.ID
FROM Employee_Table E
WHERE E.DATE = (SELECT MAX(EA.DATE)
            FROM Employee.Table EA
            WHERE EA.EMPLID = E.EMPLID
            AND EA.DATE <= SysDate)

I think it's an odd statement and I was curious as to whether it was optimized. Thanks for any feedback

Sincerely,
Tim"
   

- Advertisement -