Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error converting date and/or time from character string 1

Status
Not open for further replies.

mchambers

MIS
Aug 28, 2008
56
US
Hello,

I am trying to group some rows of data so I get the most recent value. Tried to use a substring but received this error. Any help will be greatly appreciated.

Msg 241, Level 16, State 1, Line 1
Conversion failed when converting date and/or time from character string.

SQL:
 select 
Audit_Tool.*
from
 (select patientid, max(EntryDate) as EntryDate
  from Audit_Tool group by patientid) as lastest_entry
inner join Audit_Tool
  on Audit_Tool.patientID = lastest_entry.patientID and
Audit_Tool.EntryDate = lastest_entry.patientID
 
Shouldn't this:
Code:
and Audit_Tool.EntryDate = lastest_entry.[red]patientID [/red]
be
Code:
and Audit_Tool.EntryDate = lastest_entry.[blue]EntryDate[/blue]
[ponder]


---- Andy

There is a great need for a sarcasm font.
 
Wow I can’t believe I missed that. It’s been a long morning. Thanks for the catch!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top