在数据库中显示特定日期的详细信息 [英] Show details in database for particular date

查看:73
本文介绍了在数据库中显示特定日期的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



请帮助我,...


在sql数据库中,我有一个表,其中有一个具有日期的列....

我只需要查看该日期之前7天之前的数据在数据库中...


例如:

------------------------------------------------
日期考试科目
------------------------------------------------
13/7/2012年度英语
14/7/2012年度科学
------------------------------------------------

我只能在系统日期为6/7/2012到13/7/2012之间查看第一行数据
和第二行数据只能在2012年7月7日至2012年7月14日之间看到


可能吗?请给我查询...

Hi,,

plz help me,...


in sql database, i have a table in that have one column having date....

i need to view the data only before 7days to that date in Database...


example:

------------------------------------------------
date exam subject
------------------------------------------------
13/7/2012 Annual English
14/7/2012 Annual Science
------------------------------------------------

i can view the first row data only when system date is between 6/7/2012 to 13/7/2012
and 2nd row data can visible only between 7/7/2012 to 14/7/2012


is it possible? plz give me the query...

推荐答案

您也可以尝试以下语句:


you can also tried below statement:


select * from table where Date between dateadd(DD,-7,getdate()) and getdate()


可以尝试以下查询

Could try the following query

select * from table where Date between DATEADD(DD, -7, SYSDATETIME()) AND SYSDATETIME()


这篇关于在数据库中显示特定日期的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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