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)
 Get rec info with max time

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-09-12 : 07:39:40
Phil writes "I want to get all values from the rec with the max time

AttributeValue Machine MsgTime Message
100 ABC 1am Hello
100 ABC 2am Please
100 ABC 3am Help
100 ABC 4am Me

So I want the 4am rec.

Select AttributeValue, Machine, MaxMsgTime = Max(MsgTime)
-- Message
From x
Having this

I can get the 1st 3 values fine, but when I try to get the 4th value(message) by uncommenting the above, it returns all rows."

mmarovic
Aged Yak Warrior

518 Posts

Posted - 2005-09-12 : 07:48:56
If I got your intention right:
Select top 1 *
from x
order by msgTime desc
Go to Top of Page
   

- Advertisement -