Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting multiple realtions between SQL tables
Message
 
 
To
26/08/1999 11:09:44
Jeff Lovin
Dewitt & Company Inc
Houston, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00257938
Message ID:
00257976
Views:
17
>Good Morning
>
>I am in need of setting relations between several (3 or 4) SQL tables to perform an accurate query. Is this done with the JOIN command? Any help that you could give or pass to me would be greatly appreciated. Thank you

Yes, just do not nest the joins. You can use the View designer to get the initial fields list, joins and order. Before you exit the VD, view and copy the SQL. Escape out of the VD [the VD bombs with 3 or more tables because it will nest the joins]. Paste the SQL into a PRG. I keep a separate PRG where I have a separate PROCEDURE for each view. From there you can un-nest the joins and add the Create SQL View prefix:
create sql view My_view [remote connection con_name share] as ;
select ... 
   from table1 ;
     [join_type] join table2 on table1.keyid=table2.table1_fkey ;
     [join_type] join table3 on table1.keyid=table3.table1_fkey ;
     [join_type] join table4 on table3.keyid=table4.table1_fkey ;
   where filter_conditions_here ;
   order by ...
After running the code, you can use Erik Moore's EVIEW utility from the UT Files section to set field properties, update type, etc. Then you can view that generated code and/or you can DO Home() + "tools\gendbc\GENDBC" to generate a PRG with all the code needed to create all the tables and views and set all their properties in the DBC.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform