Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indirect join
Message
From
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:
01173918
Views:
9
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.
Thanks to all for your thoughts
**************************************************************************
>Why not make it all simple and use local alias';
>
>
>lcRawData = addbs(fileloc) + "surveys/RawData2005"
>rawdata = 'RawData2005'
>lcPermID = '20011'
>lcJoincondition = 'Companyinfo.company = RawData2005.company'
>
>SELECT CI.*, RD.* ;
> FROM ;
>     COMPANYINFO CI ;
>    INNER JOIN (lcRAWDATA) RD ;
>   on CI.company = RD.company ;
> WHERE  CI.permid = ( "20011" )
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform