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 |
Todd2006
Starting Member
18 Posts |
Posted - 2009-02-24 : 22:04:31
|
Hello,Here is my querySo if the date in reg_date is 02/23/2009 it wont show the records when the date is 02/24/2009 but I want to display the record till 02/25/2009.So I want to display the record 2 days after the Reg_Datestrselect = "SELECT Distinct State from Registration where CDate(Reg_Date) > dateadd("day",-2,Date())"but it doesnt work is the dateadd function rightCan someone tell me what change in the query I have to make.todd |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-03 : 09:24:44
|
strselect = "SELECT Distinct State from Registration where Reg_Date > dateadd(day, -2, getDate())" E 12°55'05.63"N 56°04'39.26" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-03-03 : 09:30:27
|
In ACCESSstrselect = "SELECT Distinct State from Registration where Reg_Date > dateadd("d", -2, Date())"MadhivananFailing to plan is Planning to fail |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-03 : 09:43:59
|
strselect = "SELECT Distinct State from Registration where Reg_Date > dateadd(""d""", -2, Date())" ??? E 12°55'05.63"N 56°04'39.26" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-03-03 : 10:11:14
|
Yes I forgot to notice it was part of assigning to variableBut I doubt it should bestrselect = "SELECT Distinct State from Registration where Reg_Date > dateadd(""d"", -2, Date())"MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|