Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL syntax help
Message
De
07/01/2000 12:13:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
07/01/2000 11:35:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00314532
Message ID:
00314553
Vues:
20
>I'm trying to select a list of records from 4 tables. What I want is to select only records from the parent table (CASELIST) where the record id is the intersection of CASELIST, ACTLIST, CASEPERLIST (only records whose key value is in all three tables). But I only want to select the records in CASEPERLIST that Inner join with a fourth table (PERSONLIST).
>
>Could anyone tell me if this syntax is correct.
>
>Select DISTINCT CaseList.* From ;
> CaseList Inner Join ActList ;
> Inner Join CasePerList ;
> Inner Join PersonList ;
> ON PersonList.cPerson_id = CasePerList.cPerson_id ;
> ON CasePerList.cCase_id = ActList.cCase_id ;
> ON ActList.cCase_id = CaseList.cCase_id ;
> Into Cursor CaseSQL
>
>Is there a better way (sequential rather than nested Joins) to write this?
>
>TIA


Hard to grasp w/o a sampling :) Yours seem OK. My suggestion is to place "ON ..." parts just following its "join TableName " so you could follow joins easier (Unfortunately designer does it like you do). Also you could try this :
Select CaseList.* From ;
  CaseList Inner Join ActList ;
     ON ActList.cCase_id = CaseList.cCase_id ;
  Inner Join CasePerList ;
     ON CasePerList.cCase_id = CaseList.cCase_id ;
  Inner Join PersonList ;
	ON PersonList.cPerson_id = CasePerList.cPerson_id ;
 Into Cursor CaseSQL
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