SQLite Forum

Repeat values n times
Login
I have below table;

sku,qty
-------
item1,3
item2,2
item3,5
item4,4

I want values of sku column to be repeatedly inserted n number of times specified in qty column so the result looks like below;

sku,qty
-------
item1,3
item1,3
item1,3
item2,2
item2,2
item3,5
item3,5
item3,5
item3,5
item3,5
item4,4
item4,4
item4,4
item4,4

I checked and read about the recursive command table expression but find difficult to practically implement it. I want to learn basics of it.