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)
 Max Distinct Date with Time

Author  Topic 

Girlnet
Yak Posting Veteran

77 Posts

Posted - 2009-10-21 : 16:58:52
How would I get the max date with time?

Select QAD_rqda_det.rqda_nbr, MAX(DATEADD(s, dbo.QAD_rqda_det.rqda_time, dbo.QAD_rqda_det.rqda_date))
from QAD_rpda_det
Group by QAD_rqda_det.rqda_nbr

Produces 3 rows
10/21/2009 6:20:00 AM
10/21/2009 9:01:00 AM <---------- Only want this one!
10/21/2009 7:19:00 AM

This will give me the last time the req was updated.

Thanks very much!

X002548
Not Just a Number

15586 Posts

Posted - 2009-10-21 : 18:10:58
does that really work?

Please post DDL and sample Data as DML statements


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

cjonline
Yak Posting Veteran

55 Posts

Posted - 2009-10-26 : 10:49:34
could try a select top 1
Go to Top of Page

Girlnet
Yak Posting Veteran

77 Posts

Posted - 2009-10-26 : 11:05:55
Thanks guys - It was actually my stupidity. It was my join causing the problem not the statement.
Go to Top of Page
   

- Advertisement -