0

I have 3 tables.

Table1: Group_Code, Group_Name,companyID;(PK: Group_Code)
Table2: PartyID,GroupID,companyID;(FK: GroupID, PK:PartyID)
Table3: VendorID, companyID;(FK:VendorID)

I want to fetch Group_Name from Table1 for all VendorID of Table3. How can I do this?

here i write a code. But it shows "Syntex error in FROM clause." My database is in ms access.

select Group_Name from Table1 join Table2 on Table1.Group_Code= Table2.GroupID
join Table3 on Table2.PartyID=Table3.VendorID
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
Animesh Ghosh
  • 331
  • 8
  • 16
  • 28

5 Answers5

1
select Group_Name from Table1 
join Table2 on Table1.Group_Code = Table2.GroupID 
join Table3 on Table2.PartyID = Table3.VendorID
Punching Worms
  • 113
  • 1
  • 7
1

try this !!!

SELECT table1.group_name FROM (table1
     INNER JOIN ON table1.group_code=table2.groupid)
        INNER JOIN table3 ON table2.partyid=table3.vendorid

    GROUP BY    table1.group_name
vhadalgi
  • 7,027
  • 6
  • 38
  • 67
0
SELECT table1.group_name FROM table1 join table2 
                   ON table1.group_code=table2.groupid
                       join table3 ON table2.partyid=table3.vendorid

error becoz you didnt take the group name DB instance ?
vhadalgi
  • 7,027
  • 6
  • 38
  • 67
0

You Can do this :

select Table1.Group_Name, Table3.VendorID from Table1 join Table2 on Table1.Group_Code= Table2.GroupID join Table3 on Table2.PartyID =Table3.VendorID

If you are data has been stored in proper relationship. the query should get you going. :)

Jeet
  • 1,587
  • 1
  • 9
  • 22
0

use this code for question,

Select Table1.Group_Name  from ((Table1
left join Table2 on Table1.Group_Code=Table2.GroupID)
left join Table3 on Table2.PartyID=Table3.VendorID)
kasim
  • 346
  • 2
  • 5
  • 23