| Author |
Topic |
|
ALindy
Starting Member
3 Posts |
Posted - 2009-10-06 : 09:37:29
|
| I am using GetDate to pull data from today and earlier.SELECT*WHERE(TMOS_Data.DueOnDock<=GetDate())I want to pull data from 5 days from today and earlier(TMOS_Data.DueOnDock<=GetDate ?+5 days? ())Any help would be appreciated.Thanks,ALindy |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-06 : 09:43:07
|
| SELECT*WHERE(TMOS_Data.DueOnDock<=GetDate()+5)MadhivananFailing to plan is Planning to fail |
 |
|
|
ALindy
Starting Member
3 Posts |
Posted - 2009-10-06 : 10:06:28
|
| Thanks! that worked perfectly.Thanks,ALindy |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-07 : 01:54:03
|
quote: Originally posted by X002548
quote: Originally posted by madhivanan(TMOS_Data.DueOnDock<=GetDate()+5)
5 Days in the future?SELECT * FROM @t99 WHERE TMOS_Data.DueOnDock > SELECT DATEADD(dd,-5, CONVERT(varchar(10), GetDate(),1)) Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam
See what OP specifiedI want to pull data from 5 days from today and earlierMadhivananFailing to plan is Planning to fail |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-10-07 : 02:05:49
|
I would interpret that statement as Brett "from today and earlier" to me will be a past date. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
winterh
Posting Yak Master
127 Posts |
Posted - 2009-10-07 : 04:55:49
|
quote: I want to pull data from 5 days from today and earlierMadhivananFailing to plan is Planning to fail
Dang Noobs, read it properly, Madhivanan was right! lol. I am sorry, I am the only noob here. :)[ /fail at query] |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-07 : 06:29:33
|
ALindy wrote: quote: Thanks! that worked perfectly.
So what?We cannot assume that ALindy isn't able to decide if the result is right or wrong! No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2009-10-07 : 09:31:57
|
Well...if you want to be pickyThe MIN(Statement_Row_Num)) Says:quote: Originally posted by ALindy I am using GetDate to pull data from today and earlier.
Then he goes no to say...quote: I want to pull data from 5 days from today and earlier
And then the codeSELECT*WHERE(TMOS_Data.DueOnDock<=GetDate()) Which initmates in the pastBut then everyone sees this(TMOS_Data.DueOnDock<=GetDate ?+5 days? ()) which is the ONLY thing that leads us to the discussion of future dates....which I think is a mistakeBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
ALindy
Starting Member
3 Posts |
Posted - 2009-10-07 : 09:48:04
|
| Hi everyone. To clear things up... I was pulling Due on Dock information for everything that was late and DOD today. I wanted to change that to pull everything that was late AND everything DOD in the next week, so that would be 5 days in the future, today, and all past DOD shipments. For my simple query, (TMOS_Data.DueOnDock<=GetDate()+5) got me exattly what I wanted. Thanks for all of your interest.Thanks,ALindy |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-07 : 09:52:58
|
quote: Originally posted by ALindy Hi everyone. To clear things up... I was pulling Due on Dock information for everything that was late and DOD today. I wanted to change that to pull everything that was late AND everything DOD in the next week, so that would be 5 days in the future, today, and all past DOD shipments. For my simple query, (TMOS_Data.DueOnDock<=GetDate()+5) got me exattly what I wanted. Thanks for all of your interest.Thanks,ALindy
Ok. This clears up the things MadhivananFailing to plan is Planning to fail |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-07 : 10:00:13
|
I think it wasn't picky to say that ALindy should be able to decide if the result is right or wrong.But anyway Brett - you're right in having doubts because of that irritating text.friends?  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2009-10-07 : 11:19:25
|
quote: Originally posted by webfred I think it wasn't picky to say that ALindy should be able to decide if the result is right or wrong.But anyway Brett - you're right in having doubts because of that irritating text.friends?  No, you're never too old to Yak'n'Roll if you're too young to die.
Friends...plovers no moreBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
|