MySQL Forums
Forum List  »  MySQL Query Browser

Duplicating rows based on quantity field
Posted by: simon Downes
Date: May 10, 2011 04:14AM

I have a table which stores customer orders. The orders are collected automatically from various ftp servers and are delivered in a tab delimited file.

In the past if an order had been received for a multiple of the same product the details were delivered on a different row for each line with a quantity of 1. E.g if customer 'A' ordered 3 of SKU '0001' the file would be delivered as


customer SKU QTY
A 0001 1
A 0001 1
A 0001 1

This has now been changed so that orders are consolidated onto 1 line

customer sku QTY
A 0001 3


The rest of the process relies on there being a row for every item ordered so I need to find a way to break down the qty into individual lines. I cannot think of a way to do this automatically as the quantity order can be infinite. I wonder if anyone can help?

Options: ReplyQuote


Subject
Written By
Posted
Duplicating rows based on quantity field
May 10, 2011 04:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.