本文介绍了如何在运营商之间使用日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
select * From Table BETWEEN '23 / 3/2016'和'23 / 3/2016'
我尝试过:
我正在尝试运行此查询,但它为我提供了两个日期之间的数据,并没有显示第一个和最后一个日期的数据
select * From Table where Date BETWEEN '23/3/2016' AND '23/3/2016'
What I have tried:
I'm trying to run this query but it gives me the data between two dates and does not show me the data for 1st and last date
推荐答案
select * From Table where Date BETWEEN '23/3/2016 00:00:00' AND '23/3/2016 00:00:00'
这在使用比较而非 BETWEEN
时也适用。
所以有两种常见的解决方案:
使用 BETWEEN
结束日期的时间:
This applies also when using a comparison rather BETWEEN
.
So there are two common solutions:
Use BETWEEN
with time for end date:
select * From Table where Date BETWEEN '23/3/2016' AND '23/3/2016 23:59:59.999'
或者使用少于第二天结束日期的比较:
Or use less than comparison for the end date with the following day:
select * From Table where Date >= '23/3/2016' AND Date < '24/3/2016'
select * From Table where Date >='23/3/2016' AND Date <='23/3/2016'
select * from non_gia_search_history where convert(varchar(10),create_time,110)>='03-15-2016' and convert(varchar(10),create_time,110) <='03-19-2016'
这篇关于如何在运营商之间使用日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!