0

I am trying to get the latest Date with Time in SQL using Max, but I got inaccurate results.

select distinct AccountId, 
       max (CreateDate)as Date, 
       text as Info 
from comments 
group by accountid,text
order by AccountId desc

incorrect Table

Expected

Expected

I also tried to use max(convert(varchar(20),createdate,120)) as Date. It's still the same result.

Need assistance.

Thanks

Dale K
  • 25,246
  • 15
  • 42
  • 71
Felix JIN
  • 101
  • 1
  • 1
  • 11
  • As per the question guide, please do not post images of code, data, error messages, etc. - copy or type the text into the question. Please reserve the use of images for diagrams or demonstrating rendering bugs, things that are impossible to describe accurately via text. – Dale K Oct 28 '22 at 04:57

0 Answers0