关于between...and....的问题
CREATE TABLE dbo.DateTest(PK INT IDENTITY,
OrderDate DATETIME
)
go
INSERT dbo.DateTest(OrderDate)
VALUES('10/9/01 00:00')
INSERT dbo.DateTest(OrderDate)
VALUES('10/9/01 23:59')
INSERT dbo.DateTest(OrderDate)
VALUES('10/9/01 11:59:59.995 pm')
INSERT dbo.DateTest(OrderDate)
VALUES('10/9/02');
建一张表
执行查询语句
SELECT *
FROM dbo.DateTest
WHERE OrderDate BETWEEN '10/9/1' AND '10/9/1 11:59:59.998 PM';
结果如下
问题:为什么第3条数据不是23:59:59.995而是997?