Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select - SQL dilemma
Message
 
À
21/07/1998 16:59:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00119839
Message ID:
00120102
Vues:
19
Hi John,
Rule of Thumb : If you have 3 or more tables and more than 1 outer join, view designer is not the place.

It saves a lot of time maintaining the view for such a case from a seperate program instead.

>Thanks. I was trying to use View Designer and it was misplacing certain keywords in the SELECT statement and I couldn't remember them....this was embarrassing, almost like forgetting your kid's name or something :)
>
>Thanks again.
>
>
>>John --
>>
>>Here is a quick example. My code uses OUTER JOINs, but the idea is similar for your INNER JOIN situation.
>>
>>HTH -- Bill
>>
>>PS -- This code was all nicely formatted with indentation, etc., but it is hard to say what it sill look like when I click the SEND button...hope it is easy for you to read.
>>
>>CREATE SQL VIEW lv_Family_Students AS ;
>> SELECT Student.StudentID, Student.LastName, ;
>> Student.FirstName, Student.MiddleInitial, ;
>> Student.BirthDate, Student.Gender, ;
>> Student.AddressID, ;
>> Location.LocationName, ;
>> RCurric.CurriculumName, ;
>> RProgram.ProgramName, ;
>> RRank.RankName, ;
>> RStatus.StatusName ;
>> FROM MAT!Student ;
>> LEFT OUTER JOIN MAT!Location ;
>> ON Student.LocationID = Location.LocationID ;
>> LEFT OUTER JOIN MAT!RCurric ;
>> ON Student.CurriculumID = RCurric.CurriculumID ;
>> LEFT OUTER JOIN MAT!RProgram ;
>> ON Student.ProgramID = RProgram.ProgramID ;
>> LEFT OUTER JOIN MAT!RRank ;
>> ON Student.RankID = RRank.RankID ;
>> LEFT OUTER JOIN MAT!RStatus ;
>> ON Student.StatusID = RStatus.StatusID ;
>> WHERE Student.FamilyID = ?Family.FamilyID ;
>> ORDER BY Student.LastName, Student.FirstName
>>
>>>I have a problem getting my syntax down on the following problem:
>>>
>>>I have a table which contains a status code,an employee code,and a resolution code. I want to create a view that is an INNER JOIN between the master table and three subtables (status,employee,resolution) containing a descriptive field from each subtable in the result view.
>>>
>>>Can somebody post a good example of this? Thanks
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform