I’ve this table with the following data
Job Quantity Status Repeat
1 100 OK 2
2 400 HOLD 0
3 200 HOLD 1
4 450 OK 3
Based on the value in the Repeat column for each row, the row should be repeated again. For example for the Job 1, Repeat value is 2 so the Job 1 should repeat two more times.
The resultant table should be as below
Job Quantity Status Repeat
1 100 OK 2
1 100 OK 2
1 100 OK 2
2 400 HOLD 0
3 200 HOLD 1
3 200 HOLD 1
4 450 OK 3
4 450 OK 3
4 450 OK 3
4 450 OK 3
Can someone please help me out with this query?
I’m using sql server
This will support over 7,400 repeats for any individual job (on my system). If you need more, you can use a different system table or a cross join.