February 5, 2010 at 2:15 am
As a result of a data import the ffg table was created.
Date Store A Store B Store C Store D Store E
2009-01-31 100 150 300 400 500
2009-02-28 300 170 200 550 489
2009-03-31 210 200 260 530 420
I need to insert the data into the ffg table
Date
StoreID
Sales
This is my reference table for the Store Ids
StoreID StoreName
1 Store A
2 Store B
3 Store C
4 Store D
5 Store E
At some point more store will be added and as a result, the import data table will have an extra column matching the store name.
I need a query that pulls out the data from the data import table using the store names from the Store Table.
I need a query flexible enough that can cater for new store names without it being known.
February 8, 2010 at 2:56 am
See if this helps. Look for the UNPIVOT usage.
February 8, 2010 at 12:58 pm
Thanks. 🙂 Exactly what I was looking for.
February 8, 2010 at 1:53 pm
You're welcome...
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply