Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left Join with more than 2 tables 1

Status
Not open for further replies.

PrgmDabler

Technical User
Sep 2, 2006
2
US
I'm doing a query from MS Excel using the Query Wizard.
I'm pulling from 4 different JDE Tables.

I need to join AND left join two tables, but it tells me Left joins aren't allowed with more than two tables.

Any thoughts


MORE DETAILS
Table 1- Sales information
Table 2- Addresses
Table 3- Cstmr Names
Table 4- Phone Numbers

I'm pulling information from table 1 that includes Cstmr numbers. Sometimes there are two customers per sale.

I need the address (tbl 2), name (tbl 3), and phone number (tbl 3) of the first customer.
I need the name (tbl 3) of the second cstmr, and would also like the phone number.

When I do straight joins, it only pulls down data where there are two customers.

Its a long statement, so I haven't included it here, but I can if needed.
 
Are you sure that is the right forum?
SQL Server forum is here, not MS Office one :)
With SQL Server you didn't have limitations of number of LEFT ot RIGHT or opther joins, but I am not sure about the Excel.
What happens if you directly write:
Code:
SELECT Sales.*,
       Tbl_1.Name,
       Tbl_1.Phone,
       Tbl2.Address,
       Tbl_2.Name,
       Tbl_2.Phone
FROM Sales
LEFT JOIN Tbl3 Tbl_1 ON Sales.Cust1 = Tbl_1.CustId
LEFT JOIN Tbl3 Tbl_2 ON Sales.Cust2 = Tbl_2.CustId
LEFT JOIN Tbl2       ON Sales.Cust1 = Tbl2.CustId






Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Thanks for the tip, I think I am in the wrong forum. I've tried writing that code but it kicks me out. I'll try in a different forum and see what I find.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top