Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dupilcating Records

Status
Not open for further replies.

shaneox

IS-IT--Management
Jun 25, 2002
6
0
0
IE
Hi Guys

I am looking for a way to automate the replacing of a single record with a multiple of duplicates. An example would be:

Order number 1234 Order Quantity 3

I would like to replace this with three duplicate records with a quantity of one eg:

Order number 1234 Order Quantity 1
Order number 1234 Order Quantity 1
Order number 1234 Order Quantity 1

Does anybody know some code that may help??
Thanks in advance

ShaneoX
 
You could use an aggregate SQL function (e.g. sum() ) with an extra query to find the total number of orders and then update one of the duplicate records with the total value.

Then use another SQL query to delete all records with that order number where the quantity is not equal to the total calculated before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top