Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INSERT INTO many-to-many table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
INSERT INTO many-to-many table
Divers
Thread ID:
00035842
Message ID:
00035842
Vues:
62
I have two tables related many-to-many. I display the first of these tables in a form with a grid showing the child table that contains the keys of both parents. The second parent table has a child table of its own. I want to click a button and create new children for each of several records in parent2 that are related to the current parent1 shown in the form. I was thinking I could just

SELECT * FROM mychild INTO CURSOR mycursor WHERE keyfield == currentparentkey
SELECT mycursor
SCAN
INSERT INTO childofparent2(parentkey,field1) VALUES mycursor.parent2key, cStuff_for_field)
ENDSCAN
USE IN mycursor

but I was wondering if there was a better way. I have not yet tried this code. It doesn't seem to take advantage of the relations, or the grid. Is there anything more slick that I can do?
Répondre
Fil
Voir

Click here to load this message in the networking platform