SQL Server日期区间查询Between存在的问题
select * from order where orderdate between ‘2019-8-29’ and ‘2019-8-31’
这句只查询到2019-8-29到2019-8-30的数据,查询不到2019-8-31的数据
于是利用datediff函数又加入了一条查询当天的条件就解决了这个问题
select * from order where orderdate between ‘2019-8-29’ and ‘2019-8-31′ or datediff(day,orderdate,’2019-8-31’)=0