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)
 MAX value help

Author  Topic 

hueby
Posting Yak Master

127 Posts

Posted - 2004-12-22 : 16:57:47
Hi all,

using this query:

SELECT   MAX(timestamp4), SubJobNo, Purchord, Descr
from Jobs
GROUP by timestamp4, SubJobNo, Purchord, Descr


HOW do I get JUST the single max row (by the newest time in timestamp) to come back? Now it returns all of them still. Thanks

mikejohnson
Posting Yak Master

153 Posts

Posted - 2004-12-22 : 17:01:55
select * from jobs where timestamp4=(select max(timestamp4) from jobs)

should work...
Go to Top of Page

hueby
Posting Yak Master

127 Posts

Posted - 2004-12-22 : 17:04:51
It does... Thanks, I never thought of doing it that way. :)
Go to Top of Page
   

- Advertisement -