Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
agmac
Starting Member
4 Posts |
Posted - 2007-12-01 : 18:35:35
|
| The topic pretty much sums up my question.What would the sql query be to return only all the records in a table that are 45 days old from today. Thank you for any help in this matterAl |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-12-01 : 18:44:10
|
| where MyColumn > DATEADD(d, DATEDIFF(d, 0, GetDate()), -45)_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
agmac
Starting Member
4 Posts |
Posted - 2007-12-01 : 19:32:54
|
quote: Originally posted by spirit1 where MyColumn > DATEADD(d, DATEDIFF(d, 0, GetDate()), -45)_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com
Unfort, that didn't work, but it got me to doing more research to find the right query, here'w what ended up working.WHERE mycolumn > DATEADD('d', -100, now())The problem was probably because I am using ASP (1st) amd 2nd, I am using Access for the DB.. Thank you nevertheless, you pointed me in the right direction.Agmac |
 |
|
|
agmac
Starting Member
4 Posts |
Posted - 2007-12-01 : 19:34:19
|
| i changed my date to -100 instead of -45 btw :) Agmac |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-12-01 : 19:43:28
|
well then you should have posted in the access forum and not in the new to sql server forum, shouldn't you?and you're welcome _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
agmac
Starting Member
4 Posts |
Posted - 2007-12-01 : 19:50:12
|
| oops.. :) my bad...didn't realize that I was posting this on the SQL server threads until you just mentioned it... LOL.. I thought it meant new to SQL (period), lol... as I am new to SQL .. lol.. o.k... will now post on MS Access forums .. Sorry.. :)Agmac |
 |
|
|
|
|
|
|
|