Solved

How use left outer join with 3 tables in ACCESS?

Posted on 2000-05-10
13
252 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
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 15

Expert Comment

by:simonet
Comment Utility
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
Comment Utility
Adjusted points from 200 to 225
0
 
LVL 2

Author Comment

by:bluecomet
Comment Utility
Sorry, but that doesn't function.

it say that the join expression is not supported.

Please, need me!
0
 
LVL 2

Author Comment

by:bluecomet
Comment Utility
hehehehe...

funny, no!

sorry,

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

Expert Comment

by:simonet
Comment Utility
What database are you using?

Alex
0
 
LVL 2

Expert Comment

by:hhamster
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 3

Accepted Solution

by:
shenqw earned 225 total points
Comment Utility
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
Comment Utility
yor must change "p.idcust" into "p.idcust_R" in my answer!  :)

Good Luck!

shenqw
0
 
LVL 15

Expert Comment

by:simonet
Comment Utility
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
Comment Utility
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
Comment Utility
>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
Comment Utility
:)))

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
Comment Utility
OK... my bad!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now