SQL Query以日期作为参数 [英] SQL Query with date as the parameter

查看:210
本文介绍了SQL Query以日期作为参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一张包含以下结构的桌子



Id(pk), regid,secid,pkid,ad1,ad2,ad3,ip,status,statusdate



我想在所有给定时间段内选择行,例如,如果我给11-02-2013和17-02-2013,它将检索行,如果在2013年2月11日至2013年2月17日之间的每个日期可用。



请帮我查询选择查询



问候

Hi,

I have a table with the following structure

Id(pk),regid,secid,pkid,ad1,ad2,ad3,ip,status,statusdate

I want to select rows if it is available on all the given period for example, if i give 11-02-2013 and 17-02-2013, it will retrieve rows, if is available on each date between 11-02-2013 and 17-02-2013.

Please help me with the select query

regards

推荐答案

使用介于之间:

Use between :
select * from [tablename] where statusdate between '2013-02-11' and '2013-02-17'


这篇关于SQL Query以日期作为参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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