T-SQL Challenge

We have this basic SELECT statement:

SELECT product_id, we_date, sum(demand_units)
FROM weekly_transactions
WHERE demand_units > 0
GROUP BY product_id, we_date
ORDER BY product_id, we_date

However, 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?
imani_technology_spam [ Mi, 17 Oktober 2007 21:47 ] [ ID #1847188 ]
Datenbanken » comp.databases.ms-sqlserver » T-SQL Challenge

Vorheriges Thema: A suitable SQL Server book for my goals
Nächstes Thema: Can you help me test my MS SQL test on my new testing website