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 |
|
Trudye
Posting Yak Master
169 Posts |
Posted - 2009-10-25 : 15:29:57
|
| Hi Guys, got a question. I have to select data based on a date range between 12/9/2009 and 3/17/2010. After 3/17/2010 I have to use a different criteria. I tried using the IF statement but couldn't figure out how to configure it. I tried using between, tried AND with 2 selects, and my personal favorite concatinated IF statements. Any ideas how I can accomplish this task?Thanks much, |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2009-10-25 : 17:07:39
|
| If it's the same data, just a different place, try the case state whenSELECT CASE WHEN theDate between '12/9/2009' and '3/17/2010' then t1.Data1 else t1.Data2FROM yourtableTo get your question answered, though, you're going to have to provide a lot more infoJimEveryday I learn something that somebody else already knew |
 |
|
|
|
|
|