锄头解决它我在日期之间调用数据时获取额外数据 [英] Hoe To Resolve It I M Getting Extra Data While Calling Data Between Date
本文介绍了锄头解决它我在日期之间调用数据时获取额外数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据库,其表格如下: -
i have a database with a table like:-
ID Name Amount Date
001 abc 200 01/05/2014
001 abc 200 02/05/2014
001 abc 200 03/05/2014
001 abc 200 31/05/2014
001 abc 200 01/06/2014
001 abc 200 02/06/2014
我打电话的时候带查询的数据
when i am calling data with query
select * from table_name where Date_ between '01/05/2014' and '31/05/2014' ORDER BY CONVERT(DateTime, Date_, 103) DESC";
它向我显示 01/06/2014的额外数据
和 02/06/204
以及日期数据 01/05/2014
和 31/05/2014
所以如何解决它
i trired
it is showing me extra data of 01/06/2014
and 02/06/204
along with data of date between 01/05/2014
and 31/05/2014
so how to resolve it
i trired
推荐答案
介于那个日期之间,从那个日期开始。
意味着包括01/05/2014和31/05/2014
如果你想排除它们,那么试试>和<操作员在使用之前确保没有时间附加你的日期然后它可能会产生错误的输出。
Hi,
Between means start from that date till that date.
it means that including 01/05/2014 and 31/05/2014
If you want to exclude them then try > and < operator before using be sure there is no Time is attached with your date then it may produce a wrong output.
select * from expence where CONVERT(DateTime,Date_,103)> = CONVERT (DateTime,'01/08/2014',103)和CONVERT(DateTime,Date_,103)< = CONVERT(DateTime,'31 / 08/2014',103)按Date_ DESC排序
select * from expence where CONVERT(DateTime, Date_, 103) >= CONVERT(DateTime, '01/08/2014', 103) and CONVERT(DateTime, Date_, 103) <= CONVERT(DateTime, '31/08/2014', 103) order by Date_ DESC
select * from table_name
where
Date >= '01/05/2014' and Date <= '31/05/2014'
这篇关于锄头解决它我在日期之间调用数据时获取额外数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文