问题到日期范围检查 [英] problem to date range check
本文介绍了问题到日期范围检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里是我的桌子= h_leave
date1 date2 hkey
07/11/2013 10/11/2013 1
10/11/2013 11/11/2013 2
15/11 / 2013 17/11/2013 3
i希望如果我在2013年11月9日填写申请表,那么从数据库中检查是否发生任何范围的检查
和09/11/2013一样
07/11/2013 10/11/2013
find
所以答案是
date1 date2 hkey
07/11/2013 10/11/2013 1
如何得到这样的答案
解决方案
哇。以后几次尝试,基于你是多么完全失去,试试这个:
从h_leave中选择date1,date2,hkey,其中date1> = @date和date2< = @date
将@date替换为您正在检查的日期,作为proc中的参数或使用参数化查询。
dear sir/ma'am
here is my table=h_leave
date1 date2 hkey
07/11/2013 10/11/2013 1
10/11/2013 11/11/2013 2
15/11/2013 17/11/2013 3
i want that if i fill an application at 09/11/2013 then from database the checking is occur that is any range find
as in 09/11/2013
07/11/2013 10/11/2013
find
so the answer is
date1 date2 hkey
07/11/2013 10/11/2013 1
how such an answer i got
解决方案
Wow. Several attempts later, based on how completely lost you were, try this:
select date1, date2, hkey from h_leave where date1 >= @date and date2 <= @date
Replace @date with the date you're checking, either as a param in a proc, or using a paramaterized query.
这篇关于问题到日期范围检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文