select * from table where date =dateadd(dd,-7,getdate())

解决方案 »

  1.   

    select * from tablename where 日期 between (SELECT DATEADD(day, -7, getdate())) and (getdate())  order by 日期 desc
      

  2.   

    select * from table where date > dateadd(dd,-8,getdate())
      

  3.   

    select * from table where 时间=dateadd(day,-7,时间)
      

  4.   

    select * from tablename where datediff(day,日期,getdate())<7
      

  5.   

    不好意思 应该是 select * from table where 时间>=dateadd(day,-7,时间)
      

  6.   

    select  * from tablename 
    where convert(char(10),時間,120)>convert(char(10),dateadd(dd,-7,時間),120)
      

  7.   

    呵呵,数据库最近七天的数据不能用 getdate()函数,数据库最新的时间不是当天的时间啊。