Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Syntax fo SELECT with several OUTER JOINs (VFP 5)?
Message
From
25/09/1998 16:52:26
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00140952
Message ID:
00141026
Views:
29
>I have a main table (schedule) with several (6) look-up tables (location, category, contact, ...).
>
>They are related by key fields (schedule.loc_id -- location.loc_id, etc.) The schedule table does not necessarily have these fields entered (the client wants them optional).
>
>What is the syntax for several outer joins with SELECT? I took a shot at it with the query builder, but it doesn't retrieve the right data either.
>
>Setting relations and running reports works, but I have to export this to Excel.
>
>Any help or alternatives are greatly appreciated.

Sorry. My browser sometimes has difficulty with my proxy server and I lose the text of my replies. Anyway...

This relates to a question I posted two days ago. Actually we've found that those cheezy blank rows (we use -1 ids) are faster than outer joins.

Other than that we've also noticed that the way that VFP builds the SQL statment for complex outer joins is incorrect. Barb, correct me if I'm wrong.

It builds this:

select * ;
FROM central!people ;
LEFT OUTER JOIN central!firm;
LEFT OUTER JOIN central!address ;
ON People.firmid = Address.firmid ;
ON People.firmid = Firm.firmid;
WHERE People.last = "Smith"

But it should build this:

select * ;
FROM central!people ;
LEFT OUTER JOIN central!firm;
ON People.firmid = Address.firmid ;
LEFT OUTER JOIN central!address ;
ON People.firmid = Firm.firmid;
WHERE People.last = "Smith"

The former returns the wrong subset. I think. Check it out yourself. I use gendbc to generate the code for my views and change the SQL by hand.

paul
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform