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 |
|
esthera
Master Smack Fu Yak Hacker
1410 Posts |
Posted - 2007-07-17 : 03:01:52
|
| I have a queryselect * from incomingletters where status='new' and datefilecreated<getdate()-3now I really want this to return all with the new status that datefilecreated is more then 3 days old (but 3 work days monday-friday) - now it's just returning 3 days.does anyone have any ideas on how I can do this? |
|
|
cas_o
Posting Yak Master
154 Posts |
Posted - 2007-07-17 : 04:31:09
|
| [code]select * from incomingletters where status='new' and datefilecreated < case when datename(dw, getdate()) = 'Wednesday' or datename(dw, getdate()) = 'Tuesday' or datename(dw, getdate()) = 'Monday' then getdate()-5 else getdate()-3 end [/code]This is best I can think of off top of my head. I'm sure there's a better way. If I think of it I'll post it.;-]... Quack Waddle |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
aravindt77
Posting Yak Master
120 Posts |
Posted - 2007-07-17 : 05:05:22
|
| Could you please explain the last sentence once again |
 |
|
|
|
|
|