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
 Transact-SQL (2000)
 Ordering results

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-17 : 08:42:08
CaliCreole writes "I am running a query where I am joining 4 tables,

select e.iEntityId,
e.dtupdateDate as EntityDate,
i.dtUpdateDate as IndDate,
c.dtUpdateDate as CompanyDate,
o.dtUpdateDate as ContactDate

from entity e
left outer join individual i on i.iEntityId = e.iEntityId
left outer join company c on c.iEntityid = e.iEntityId
left outer join contact o on o.iContactId = e.iEntityId

where e.dtUpdateDate > '6/1/2005' or c.dtUpdateDate > '6/1/2005'

i need to include a function that will only return the most recent updated record(ientityID) based on last updated date"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-17 : 08:49:48
Use top with order by date Desc

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -