April 23, 2002 at 2:49 pm
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 !!!
April 23, 2002 at 3:01 pm
SELECT * FROM mytable
WHERE Date between dateadd(dd,-10,getdate()) and getdate()
April 23, 2002 at 3:29 pm
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)
April 23, 2002 at 3:41 pm
Ok, thank you !!!
*** Never Mind *** Hehe... problem solved.
Edited by - wudoo on 04/23/2002 4:54:03 PM
April 23, 2002 at 3:44 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