Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting multiple realtions between SQL tables
Message
De
27/08/1999 14:45:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
27/08/1999 11:08:59
Jeff Lovin
Dewitt & Company Inc
Houston, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00257938
Message ID:
00258575
Vues:
15
>Dear Cetin,
>
>Thank you very much for the advice. I have included a snippet of code, so that you can actually see what I have done. This code DOES work, of which I am very happy with.
>
>SELECT product.productname, country.countryname, company.compname, ;
> city.cityname, Capacity.year, Capacity.npcapacity, ;
> Capacity.tempplant ;
> FROM dcidatabase!capacity ;
> INNER JOIN dcidatabase!product;
> ON capacity.productcode = product.productcode ;
> INNER JOIN dcidatabase!country ;
> ON Country.countrycode = val(left(capacity.tempplant,2)) ;
> INNER JOIN dcidatabase!company ;
> ON company.compcode = val(substr(capacity.tempplant,3,3)) ;
> INNER JOIN dcidatabase!city ;
> ON city.citycode=val(right(capacity.tempplant,3)) ;
> WHERE country.countrycode=80 AND;
> product.productcode=3
>
>However, there is a slight problem - I have two more tables that must be included. These tables (region & state) need to be joined with country. Is this possible? Thank you again for your help.
>
>Jeff
Jeff,
As I could see you're currently using indirect relations so with this approach you could include region and state too. If gets too complex you could first create a view (or plain SQL with nofilter) for country,region,state and use that view as if it was country table. You strategy would depend if you're going to create updatable view(s) or just for viewing data purposes.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform