Your datatype for Date1 seems to be nvarchar
. The MAX()
on nvarchar
's is a string compare. The string 30-12-2017
starts with 30
, which has the biggest ASCII code in your example. If you enter 31-11-2017
, this would be the result of MAX(date1)
.
Use a date datatype (ie datetime2
or date
) instead and it will work as you expect.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.