I have two tables Product table and Rate Table.
Product
ProductId Name
Rate
LevelId Cost ProductId
Each Product has 7 Levels and cost for each level is 100, 200.... 700.
I now need a script to take all the product Ids and Populate the Rate table , so that my end output would look like this :
Rate
LevelId Cost ProductId
1 100 1
2 200 1
3 300 1
4 400 1
5 500 1
6 600 1
7 700 1
1 100 2
and so on
Currently I insert the first 7 rows manually and then run the below query for every product id
INSERT INTO dbo.Rate (LevelID, Cost, ProductId)
SELECT LevelID, Cost, ProductId FROM dbo.Rate WHERE ProductId = 1
Can you direct me on how to fully automate my work ?