这两个查询返回不同的订单数量,并不清楚为什么.第一个where
条款是可接受的correct
版本:
where
year(OrderDate) = 2011
and MONTH(OrderDate) = 8
and DAY(OrderDate) = 3
Run Code Online (Sandbox Code Playgroud)
但如果我说一些非常相似的话:
WHERE
io.OrderDate >= '2011-08-03 00:00:00'
and io.OrderDate <= '2011-08-03 11:59:59'
Run Code Online (Sandbox Code Playgroud)
我得到了完全不同的记录数.在日期格式化中我有什么问题吗?或者我在逻辑中缺少什么?我更愿意说后者,因为它更容易使用恕我直言.