Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to join 3 tables
Message
From
21/10/2003 19:04:38
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00840872
Message ID:
00840886
Views:
18
Please disregard my last reply, because:
sele ;
      a.pn, ;
      b.desc, ;
      c.name ;
      distinct ;
   from ;
      pnvendor a left join inv b on a.pn = b.pn, ;
      pnvendor a left join vendor c on a.vendorid = c.vendorid ;
   where ;
      "1004" $ a.vendorid .and. ;
      "04AV205" $ a.pn
gives me totaly wrong results. I probably didn't discribe the problem correctly.

i need to join the 3 tables (pnvendor beeing the parent table). however it is possible that in 1 (or both) of the child tables the approbriate record is missing. if i were to 'join' the tbls through the where clause i would not get all the required records from pnvendor.

the querry i need should include all relevant records from the pnvendor and leave the fields (b.desc, c.name) blank if there is no matching record in the child table.

i appologize for the missunderstanding, and hope this made it clearer.


>See inline.
>
>>hello everybody
>>
>>i have 3 tables i need to join
>>pnvendor
>>inv
>>vendor
>>i am able to join the first 2 tables
>>sele a.pn ;
>>   from pnvendor a ;
>     left join inv b on a.pn = b.pn ;
>     LEFT JOIN vendor v on v.vendorid = a.vendorid ;
>>   where ;
>>      "1004" $ a.vendorid .and. ;
>>      "04AV205" $ a.pn
>>how do i add the 3rd table. the 3rd table (vendor) needs to be joint to the 1st table (pnvendor) on the vendorid field in the same way the 1st and the 2nd table are joint.
>>
>>thank for all your help as always!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform