Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Many to Many?
Message
 
 
À
24/09/2000 16:12:08
Criss Jensen
Injury Prevention Research Center
Iowa City, Iowa, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00420303
Message ID:
00420341
Vues:
18
Criss,

You can have many tables join to a single codes table. Whenever you use a SELECT statement just use an AS clause on the JOINs to make things easier to read. For example:
create sql view windowsview as;
SELECT windows.iID, cWindowLetter,;
  nQuantity, nWidth, nHeight,;
  nCostPerSqFt, nPrice, lNameplate,;
  lProtectiveCovering, lLightbox, lFrames,;
  lFinalMeasurement, ;
  lCircular,;
  CodesStyle.cValue as cWindowStyle, ;
  CodesTop.cValue as cWindowTop ;
  FROM  windows ;
  INNER JOIN codes as CodesStyle;
     ON  windows.iStyle = CodesStyle.iID;
  INNER JOIN codes as CodesTop;
     ON  windows.iTopShape = CodesTop.iID ;
 WHERE windows.iProject = ?Projects.iID ;
 order by cWindowLetter
>I have all my system codes in one table. I also have city, county, and state codes in their own tables. Am I setting myself up for major headaches with this? I have a patient table which contains the home address along with multiple system codes for marital status, race, sex, etc. This table is related to an Emergency Dept. visit table with its multiple system codes. The Visit table is related to an Injury table, which has system codes and an address for where the injury took place, and to an EMS table that has the city in which the Emergency Medical Service is located, etc.
>
>Do I need to set up intermediary table for these M -> M relationships or is there a way to get the codes and city, state, etc. names instead of primary keys in views and reports? Any tips are appreciated.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform