Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
3 table join
Message
From
15/02/2011 20:22:53
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
3 table join
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01500313
Message ID:
01500313
Views:
97
I have a set of three table I would like to join (I intend to produce a report and want to have only one source table for the report). Here is a mock-up of the three tables
TABLE: MAIN
PK   date     desc.......................etc.
1     d1      desc1
2     d2      desc2

TABLE parts
PK    FK     pno     pdesc
1     1       p1     pdesc1
2     1       p2     pdesc2
3     2       p3     pdesc3

TABLE tools
PK     FK     tno     tdesc
1       1      t1     tdesc1
2       2      t1     tdesc1
3       2      t2     tdesc2
4       2      t3     tdesce
I want the result to be
PK     date     desc     pno     pdesc     tno     tdesc
1       d1      desc1    p1      pdesc1    t1      tdesc1
1       d1      desc1    p2      pdesc2
2       d2      desc2    p3      pdesc2    t1      tdesc1
2       d2      desc2                      t2      tdesc2
2       d2      desc2                      t3      tdesc3
Keeping in mind that this is VFP8..........

I can, if necessary, get this result using xBase coding, but I'm hoping (even though I haven't figured it out) that there some SQL command (or sequence of commands) which could produce the desired result. (The repeated values for date and desc could be blank)

Thanks for any and all suggestions...........Rich
Next
Reply
Map
View

Click here to load this message in the networking platform