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 |
JRobinson
Starting Member
3 Posts |
Posted - 2007-10-17 : 15:49:37
|
I might have originally posted this in the wrong place, but here goes.We have this basic SELECT statement:SELECT product_id, we_date, sum(demand_units) FROM weekly_transactionsWHERE demand_units > 0GROUP BY product_id, we_dateORDER BY product_id, we_dateHowever, for each Product and WE_DATE, we also want the demand units for the previous 10 weeks. So far week ending 9/23/2007, we want the demand_units for that week PLUS the demand_units for the previous 10 weeks. I have NOT idea how to pull this off! Can anyone out there help me? |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-10-17 : 16:09:02
|
Duplicate, locking thread.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|