Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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...
Posted
Comments
Vasim889 20-Jul-12 8:54am    
actually what is your problem and please detail explanation?

you can also tried below statement:


select * from table where Date between dateadd(DD,-7,getdate()) and getdate()
 
Share this answer
 
Could try the following query

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900