Solved

How use left outer join with 3 tables in ACCESS?

Posted on 2000-05-10
13
260 Views
Last Modified: 2010-04-04
I have 3 tables. One with customers. One with products and one which define categories of products. One product needn't a category. Now i will show with a select statement for all customers, to have all the products they have payed with the products categories or not.
I tried with left outer join and i could only put two tables(products,categories9 together. i couldn't get the customers information:

the code is like this~=:

SELECT c.name Cust, p.name, ca.name
FROM Products p LEFT OUTER JOIN Categories ca ON p.idc_R=ca.idc,
Products p LEFT OUTER JOIN Customers c ON p.idcust_R=c.idcust;

The error i get is JOIN are not supported. What i do wrong? Help me quickly, please!
0
Comment
Question by:bluecomet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 15

Expert Comment

by:simonet
ID: 2797493
Rewrite it like this:

SELECT
   c.name as Cust,
   p.name,
   ca.name
FROM
   Products p
   LEFT OUTER JOIN Categories ca
      ON (p.idc_R=ca.idc)
   LEFT OUTER JOIN Customers c
      ON (p.idcust_R=c.idcust)



Yours,

Alex
0
 
LVL 2

Author Comment

by:bluecomet
ID: 2797570
Adjusted points from 200 to 225
0
 
LVL 2

Author Comment

by:bluecomet
ID: 2797571
Sorry, but that doesn't function.

it say that the join expression is not supported.

Please, need me!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:bluecomet
ID: 2797579
hehehehe...

funny, no!

sorry,

i wanted write
please, need help and not please, need me!
0
 
LVL 15

Expert Comment

by:simonet
ID: 2797828
What database are you using?

Alex
0
 
LVL 2

Expert Comment

by:hhamster
ID: 2797836
But where's the payed information? That should be 4 tables together puted in the SELECT with JOINs. Or is it that I just don't understand enough English.

But for your example it should look like this one:

SELECT
  c.name Customer,
  ca.name Category
  p.name Product,
  FROM Products p
    LEFT OUTER JOIN Categories ca
      LEFT OUTER JOIN Customers c ON (here should be an ca, not p).idcust_R=c.idcust
    ON p.idc_R=ca.idc
....

For exact help we need exact inforamtion. Write the table structures for the Primary Keys and Foreign Keys.
0
 
LVL 3

Accepted Solution

by:
shenqw earned 225 total points
ID: 2798165
if you use MsAccess,then use follow sql:

SELECT c.name AS cust, p.name, ca.name
FROM Customers c  
     LEFT OUTER JOIN
     (
       Products p
       LEFT OUTER JOIN
       Categories ca
         ON (p.idc=ca.idc)
     )
       ON (p.idcust=c.idcust)



if use dbase or paradox,then user follow sql:

SELECT c.name AS cust, p.name, ca.name
FROM customer C
  LEFT OUTER JOIN Products p
    ON (p.idcust=c.idcust)
  LEFT OUTER JOIN Categories ca
    ON (p.idc=ca.idc)


if use Oracle,then user follow sql:

SELECT c.name AS cust, p.name, ca.name
FROM customer C,Products p,Categories ca
WHERE c.idcust=p.idcust(+)
  AND p.idc=ca.idc(+)
0
 
LVL 3

Expert Comment

by:shenqw
ID: 2798223
yor must change "p.idcust" into "p.idcust_R" in my answer!  :)

Good Luck!

shenqw
0
 
LVL 15

Expert Comment

by:simonet
ID: 2798503
shenqw, isn't not good ettiquete to answer a question like that if other experts are already working with you. You should post your comment and let the user decide. If you had been the first one in this thread, that would have been ok, but that's not the case, is it?

Watchout for that kinda behaviour, since it's not very appreciated 'round here by the other experts.

Alex
0
 
LVL 3

Expert Comment

by:shenqw
ID: 2799784
hi,simonet:
  Thx for your reminder.

  But i want say, I had write the anwer 5 hours before i post it(because Something is wrong with My ISP),Also i had tried all sql in my answer in MsAccess,DBase,Paradox, I know which is right and which is wrong in MsAccess, Because all above comments were wrong in MsAccess. So  I chose the Answer mode not Comment Mode.
0
 
LVL 15

Expert Comment

by:simonet
ID: 2971315
>Because all above comments were wrong in MsAccess

The asker never stated he's using MS Access, so you couldn't assume that and post an answer.

0
 
LVL 3

Expert Comment

by:shenqw
ID: 2990025
:)))

The title of The asker's question is "How use left outer join with 3 tables in ACCESS?"

shenqw
0
 
LVL 15

Expert Comment

by:simonet
ID: 2991157
OK... my bad!
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question