Geting all records from 10 days ago till now.

  • I have a table, whit this fields:

    ID - int

    text - text

    date - smalldatetime

    I need to get all the records from 10 days ago untill the current day... and I nedd some help how to build this query...

    Thanx !!!

  • SELECT * FROM mytable

    WHERE Date between dateadd(dd,-10,getdate()) and getdate()

  • Unless you want to run from Midnight start of day 10 ago thru today current then look at CONVERT options to return date part only. For instance if you are using US English date format mm/dd/yyyy then do

    DATEADD(d,-10,CONVERT(VARCHAR,GETDATE(),101)

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Ok, thank you !!!

    *** Never Mind *** Hehe... problem solved.

    Edited by - wudoo on 04/23/2002 4:54:03 PM

  • I use BRAZILIAN date format: dd/mm/yyyy !!!

    Thank you everybody for trying to help me... I am new here... =) !!!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply