Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Database Design
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00486276
Message ID:
00486311
Vues:
14
>I have a table a parent table called subscriber and a child table called money which share a parent child relation. In the parent table there is a primary key in the parent table called c_id and foreign key in the child table also called c_id. In the money table there is a primary key which is a composite key of a field called batch_id and c_id. Meaning that there can't exist a duplicate of batch_id and c_id. However I have another table which is called orderlineitems which is a table to hold the line items of an order. It shares a one to one relation to the money table. Each orderlineitem can have a corresponding entry in the money table. Now when I add a orderlineitem I place the batch_id and c_id in the money table. Now since the batch_id is the same for every entry in the orderlineitem my primary key fails. It seems to me that the primary key of batch_id and c_id is not correct because in fact I can have more than one entry in the money table consisting of batch_id and
>c_id. So what I think I need to do is to add a field called c_primary which will be a primary key which I will generate a unique id for. In the form where I am using the subscriber table and money table I will enter a value in the c_primary key. In order to meet the specs I will just check to make sure that there aren't two entries for the same batch_id and c_id. However in the orderlineitem table when I enter a value in the money table the value I enter in the c_primary key will be the same value as in the field in the orderlineitem table called c_primary. Then when the user delete a line item in the orderlineitem table I will know which corresponding entry in the money table to delete. The reason I they don't want to have a duplicate in the money table when using the form that has the subscriber and money table is just to make sure that when the user enter one they don't make the mistake of entering the same one more than once. Does this sound correct. Thanks

Sounds like you are on the right track... you need a Primary Key for your orderlineitem table. This should be unique for each record. You could use an integer that is unique or a composite of the batch_id, c_id, and add a line_id.

HTH
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform