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)
 field relative to max date

Author  Topic 

cray
Starting Member

9 Posts

Posted - 2005-11-10 : 17:07:57
Date Location
1/1/05 ABC
3/2/04 DEF
12/9/97 GHI

How do I get a query to just pull the location for the most recent date? I ONLY need the one location field.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-11-10 : 17:12:40
SELECT Location
FROM Table1
WHERE [Date] = (SELECT MAX([Date]) FROM Table1)

Tara Kizer
aka tduggan
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-11 : 00:14:24
or

SELECT Top 1 Location
FROM yourTable order by [Date] desc

Madhivanan

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

- Advertisement -