Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Views with few left outer joins. Problens with save,
Message
 
To
16/12/1999 01:31:18
Vladimir Zhuravlev
Institute of the Physics of Earth,Russia
Moscow Region, Russia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00304531
Message ID:
00304568
Views:
22
Vladimir,

First you have discovvered that teh view designer has limitations. It is good for building simple views, but for the more complex ones it is only useful as a tool to get the code started. You can start your view inthe designer and then View SQL copy the code and paste it in a program where you can finish the view.

Also, the view designer uses a nested join syntax like this;
FROM Table1 JOIN Table2 ;
              JOIN Table3 ;
              ON Table3 Join condition ;
            ON Table2 Join condition ...
While that syntax is acceptable it can fail to wokr properly with complex joins. The more stable join syntax is the sequential syntax;
FROM Table1 JOIN Table2 ;
            ON Table2 Join condition ;
            JOIN Table3 ;
            ON Table3 Join condition ...
Whenever you opne the view in the view designer, regardless of how you created it, the view designer changes it to the nested join syntax.

Your second example of the select that doesn't work;
create sql view view1 as ;
SELECT Tst.*, Val.* ;
 FROM  test.mytable ,test!tst LEFT OUTER JOIN test!val Val_a;
    ON  Tst.val_id = Val.valuta_id ;
    LEFT OUTER JOIN test!val ;
   ON  Tst.valuta_id = Val_a.valuta_id ;
where mytable.id=tst.id
I would suggest that you either use the JOIN syntax or the WHERE clause but not both. This query can be rephrased to;
create sql view view1 as ;
SELECT Tst.*, Val.* ;
 FROM  test.mytable JOIN test!tst ;
                      ON Test.Id = MyTable.Id ;
         LEFT OUTER JOIN test!val Val_a;
                      ON Tst.val_id = Val.valuta_id ;
         LEFT OUTER JOIN test!val ;
                      ON Tst.valuta_id = Val_a.valuta_id ;
Try that opne and see if it works for you.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform