Having trouble finding anything on this or if anyone can direct me to a question already asked, that would be great.
Table Customer
ORDER, QTY_ORDER
A1234 , 5
Select Output
ORDER, QTY_ORDER
A1234, 1 OF 5
A1234, 2 OF 5
A1234, 3 OF 5
A1234, 4 OF 5
A1234, 5 OF 5
First: using
ORDERas a column name is a terrible idea.(I used
order_idas the column name instead, to make things easier)But that is not going to be very efficient.
SQLFiddle Demo: http://sqlfiddle.com/#!4/3cdc1/2