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 2005 Forums
 Analysis Server and Reporting Services (2005)
 Unique record based on max datetime

Author  Topic 

sreenu9f
Yak Posting Veteran

73 Posts

Posted - 2010-05-11 : 13:16:44
I have a table which looks like

VisitID DateTime Response
FN10000061559 1/19/07 4:49 PM 1
FN10000166954 8/17/06 2:14 PM 1
FN10000198818 8/30/06 1:04 PM 1
FN10000201615 9/29/06 5:45 PM 1
FN10000208586 11/1/06 12:24 PM Trf
FN10000216866 8/23/06 12:19 PM Colmb
FN10000217653 12/22/06 10:00 AM FIELD HOME
FN10000227122 8/24/06 10:39 AM HAB
FN10000235855 8/11/06 11:00 AM lhc
FN10000235855 8/11/06 11:29 AM wph

i would like to have the output as only one row for each visitID with Response for the Max(DateTime). for example there are two rows for VisitID FN10000235855 with different DateTimes and different responses. i would like to have only one row with max date time in this case 8/11/06 11:29 Am with response field being wph.

please suggest.

Thanks,

sreenu9f
Yak Posting Veteran

73 Posts

Posted - 2010-05-11 : 13:18:01
sorry posted on a wrong forum will open this in TSql 2005.

Go to Top of Page
   

- Advertisement -