Add duplicate (identical) child records for 300 distinct parent records
Posted on 2008-06-11
I have an interesting challenge for you.
A little background:
Our product uses a relational database with data stored in FoxPro, SQL, or Oracle tables. For the tables involved in this query, the A0 table is the parent table and is related one-to-many by the BLDGCODE + RMID fields to the AS child table. The AS table is then related back to A0 based on BLDGCODE + RMID. There can be as many AS (child) records for one A0 record as one wishes.
A client of ours needs to duplicate the child records of one parent record (in A0 table) and assign the same 17 child records (AS table) to 300 other parent records. The parent records are defined in the A0 table and the child records are defined in the AS table (we are using FoxPro, but the same would be true if using SQL or Oracle).
My idea is to export the 17 AS (child) records for the one A0 record into an Excel spreadsheet, and copy/paste these 17 records 300 times. Then, (and here's where I need the help) merge in the A0 parent records to fill in the two fields (BLDGCODE + RMID) that make up the unique identifier that connects the A0 to the AS table.
Hopefully this question makes sense. If not, please ask away.