Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indirect join
Message
 
 
To
30/11/2006 17:47:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01171237
Message ID:
01173926
Views:
7
Use table aliases
select sites.*, ers.name, tc1.name, tc2.name, ceo1.name ;
   from (lcSites) sites ;
     left join (lcERs) ers on sites.er = ers.er_id ;
     ...
     left join (lcCEO1) ceo1 on sites.ceo1 = ceo1.person_id
>Well I solved this problem using Vladimir's suggestion. Thanks Vladimir.
>But now I have a bigger question.
>If the main table has fields containing pointers to data in other tables IE sites.er contains an er_id from table er, then
>
>
>lcSites = addbs(fileloc) + 'bluebook\sites'
>lcERs = addbs(fileloc) + 'bluebook\ers'
>
>select * , ers.name ;
>from (lcSites) ;
>left outer join ers on sites.er = ers.er_id ;
>into cursor crsTempBlueBook
>
>will produce a cursor containing the name of the er taken from the er lookup table. But how do you structure a situation where there are several of these lookups in the main table? As in:
>
>lcSites = addbs(fileloc) + 'bluebook\sites'
>lcERs = addbs(fileloc) + 'bluebook\ers'
>lcCEO1 = addbs(fileloc) + 'bluebook\people'
>lcTC1 = addbs(fileloc) + 'bluebook\people'
>lcTC2 = addbs(fileloc) + 'bluebook\people'
>
>** yielding something like
>select * , ers.name, tc1.name, tc2.name, ceo1.name ;
>   from (lcSites) ;
>   (lcERs) as ers ;
>   (lcCEO1) as ceo1 ;
>   left outer join (lcERs) on sites.er = ers.er_id ;
>   left outer join (lcCEO1) on sites.ceo1 = ceo1.person_id
>
>etc.
>
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform