Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I have a table as shown below.
Code | Qty |
A001 | 1 |
A002 | 1 |
B001 | 2 |
B002 | 3 |
I am trying to achieve the breakdown of quantity to 1 unit per row.
How do I go about using a 'for loop' to duplicate the records? Or suggest any better methods.
Code | Qty |
A001 | 1 |
A002 | 1 |
B001 | 1 |
B001 | 1 |
B002 | 1 |
B002 | 1 |
B002 | 1 |
The above is just a simple example. There could be multiple fields.
Thanks in advance!
May using While loop...
LOAD Code,
1 as Qty
FROM ...
While IterNo() <= Qty;
Here is a sample script using Inline load
LOAD RowNo() as RowNum,
Code,
1 as Qty
While IterNo() <= Qty;
LOAD * INLINE [
Code, Qty
A001, 1
A002, 1
B001, 2
B002, 3
];
I think both of you are working in the same/similar project/office as you both have same question.