在数据库中显示特定日期的详细信息
请帮助我,...
在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()