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 |
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-01-12 : 11:42:33
|
| You guys helped me with this before but my client wants to display the info the opposite way which I have now.When a user selects a date I would like for six weeks displayed (of data) at all times.If I select date 11/06/09 the dates displayed (with data) are:11/06/0911/13/0911/20/0911/27/0912/04/0912/11/09I would like for it to display this way instead11/06/0910/30/0910/23/0910/16/0910/09/09How do I change this where clause I can't figure it out.@Dist char(3),@StartDate datetimeSelect *from Totalswhere dist = @dist and sort='y' and WKDate >= @StartDate AND WKDate < DATEADD(wk, 6, @StartDate)order by WKDateBy the way these are Friday's in every month. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-01-12 : 11:47:48
|
| [code]where dist = @dist and sort='y' and WKDate >= @StartDate AND WKDate < DATEADD(wk, -6, @StartDate)order by WKDate desc[/code] |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-01-12 : 11:49:36
|
| Oops..other way..where dist = @dist and sort='y' and WKDate > DATEADD(wk, -6, @StartDate) AND WKDate <=@StartDate order by WKDate desc |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-01-12 : 11:55:18
|
| I tried that but I'm not getting any records |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2010-01-12 : 11:56:14
|
| Thanks it's working! Did see that post. |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-01-12 : 12:00:44
|
| Np.You're welcome. |
 |
|
|
|
|
|