Solved

How use left outer join with 3 tables in ACCESS?

Posted on 2000-05-10
13
256 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 209
Newbie Thread Programming 1 139
oracle global variables 4 63
How to create virtual printer while installing my application 5 24
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

16 Experts available now in Live!

Get 1:1 Help Now