![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a table on sql server. It has three columns (1-Make) (2-Model) (3-Quantity Ordered). I'm simplifying this a bit. Sample data: Ford Mustang 3 Chevy Camaro 2 I just need a stored procedure that I can run that will insert those records into a workfile based on the Quantity ordered, so if you have 3 ordered in the first table like above it will insert the columns Ford and Mustang into the workfile 3 times (3 records) and likewise the Chevy record Twice for (2 records) Example results of workfile: Ford Mustang Ford Mustang Ford Mustang Chevy Camaro Chevy Camaro This can't be that difficult but I am not a sql programmer. Any help would be appreciated. |
#3
| |||
| |||
|
|
I have a table on sql server. It has three columns (1-Make) (2-Model) (3-Quantity Ordered). I'm simplifying this a bit. Sample data: Ford Mustang 3 Chevy Camaro 2 I just need a stored procedure that I can run that will insert those records into a workfile based on the Quantity ordered, so if you have 3 ordered in the first table like above it will insert the columns Ford and Mustang into the workfile 3 times (3 records) and likewise the Chevy record Twice for (2 records) Example results of workfile: Ford Mustang Ford Mustang Ford Mustang Chevy Camaro Chevy Camaro This can't be that difficult but I am not a sql programmer. Any help would be appreciated. |
#4
| |||
| |||
|
|
SELECT Make, Model FROM TheTable as A JOIN Numbers as B ON N.i BETWEEN 1 AND A.QuantityOrdered |
![]() |
| Thread Tools | |
| Display Modes | |
| |