LeonelSanchezJr
Programmer
I have the following query, but I am getting an error stating, "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value."
The Time field is character and the Date field is DateTime.
Insert Into #Tmp3
Select A.Num,
A.Stat
From Stat A
Inner Join (Select Stat.cNum, Max(str(Stat.dDate)+Stat.cTime) As MaxDateTime
From Stat Group By Stat.cNum) As B
On A.cNum = B.cNum
And str(A.dDate)+A.cTime = B.MaxDateTime
The Time field is character and the Date field is DateTime.
Insert Into #Tmp3
Select A.Num,
A.Stat
From Stat A
Inner Join (Select Stat.cNum, Max(str(Stat.dDate)+Stat.cTime) As MaxDateTime
From Stat Group By Stat.cNum) As B
On A.cNum = B.cNum
And str(A.dDate)+A.cTime = B.MaxDateTime