SQL Server 2008,根据两个不同列中的日期检索记录 [英] Sql server 2008, retrieving the records based upon dates in two different columns

查看:96
本文介绍了SQL Server 2008,根据两个不同列中的日期检索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为"tblCinCout"的表,其中的列为"IN Date","OUT Date",还有5列.....
我正是在这里被感动的.
我想以这样的方式检索记录,即从特定的输入日期"到输出日期",包括..
假设应显示``12-7-20ll''(输入日期)和``27-7-2011''(0ut日期)这两个日期之间的所有记录...

2列之间的大量数据-完全是我的意思
现在如何为上述要求编写sql Querey ..
我尝试使用sql``BETWEEN''运算符..但没有得到解决方案

有帮助吗?


谢谢你!!
一个Pradeep

I have a table with name ''tblCinCout'' with columns ''IN Date'' ,''OUT Date'' and still more 5 columns.....
I got struck up exactly here..
I would like to retrieve the records in such a way that from particular ''IN Date'' to ''OUT Date'' including ..
suppose ''12-7-20ll''(IN Date) and ''27-7-2011''(0ut Date) all the records between these two dates should be displayed...

rage of data between 2 columns --exactly I mean
Now how to write sql Querey for the above requirement..
I have tried using sql ''BETWEEN'' operator..but didn''t get the solution

any help?


thank u !!
A Pradeep

推荐答案

select * from tblCinCout(''12 -7-20ll'',''27-7-2011'')... ..... pradeep,请尝试这样操作.
select *from tblCinCout (''12-7-20ll'',''27-7-2011'')........... pradeep please try like this.


从tblCinCout中选择InDate,其日期在"12-7-20ll"和"27-7-2011"之间
select InDate from tblCinCout where outdate between ''12-7-20ll'' and ''27-7-2011''


这篇关于SQL Server 2008,根据两个不同列中的日期检索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆