473,378 Members | 1,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Outer Join possible in Access 2002?

From what I understand, an Inner Join narrow the rows selected to the table
with the least results... and an Outer Join does the opposite...

SELECT qryTxToQ1.Q1Total, qryTxToQ2.Q2Total, qryTxToQ3.Q3Total,
qryTxToQ4.Q4Total
FROM qryTxToQ4 OUTER JOIN (qryTxToQ3 OUTER JOIN (qryTxToQ1 OUTER JOIN
qryTxToQ2 ON qryTxToQ1.TxAcct_ID = qryTxToQ2.TxAcct_ID) ON
qryTxToQ3.TxAcct_ID = qryTxToQ2.TxAcct_ID) ON qryTxToQ4.TxAcct_ID =
qryTxToQ3.TxAcct_ID;

Is my syntax wrong? Or am I trying to do something that Access 2002 will
not allow?
Nov 12 '05 #1
3 7498
Outer joins are more involved in that there are two types (Left Outer and
Right Outer).

Yes your syntax is wrong.

I can't tell what you are trying to do.

Try building your query in the Access query builder first and looking at
the SQL that it creates. But you need to look at Help for 'Join Types',
first.
Double clicking the join line in the query grid will show the Join
options, but there are restrictions on what will work with what when you
have multiple joins.

Regards

Peter Russell


deko previously wrote:
From what I understand, an Inner Join narrow the rows selected to the
table
with the least results... and an Outer Join does the opposite...

SELECT qryTxToQ1.Q1Total, qryTxToQ2.Q2Total, qryTxToQ3.Q3Total,
qryTxToQ4.Q4Total
FROM qryTxToQ4 OUTER JOIN (qryTxToQ3 OUTER JOIN (qryTxToQ1 OUTER JOIN
qryTxToQ2 ON qryTxToQ1.TxAcct_ID = qryTxToQ2.TxAcct_ID) ON
qryTxToQ3.TxAcct_ID = qryTxToQ2.TxAcct_ID) ON qryTxToQ4.TxAcct_ID =
qryTxToQ3.TxAcct_ID;

Is my syntax wrong? Or am I trying to do something that Access 2002
will
not allow?


Nov 12 '05 #2
pi********@hotmail.com (Pieter Linden) wrote in
news:bf**************************@posting.google.c om:
Access won't do the FULL OUTER JOIN that (I think) exists in Oracle.
You can do LEFT/RIGHT JOINs though. If you want to see the Access
syntax, create a query in the QBE grid with two related tables.
Right-Click on the join line and select either option 2 or 3 (both
outer joins). But those are LEFT or RIGHT, not FULL. I think to get
what you want, you may need to create the LEFT and RIGHT joins and
then UNION them together...


You'll end up with dupes that way, unless you filter them:

SELECT tblA.AField1, tblB.BField1 FROM tblA LEFT JOIN tblB ON tblA.ID = tblB.ID
UNION
SELECT tblA.AField1, tblB.BField1 FROM tblA RIGHTJOIN tblB ON tblB.ID = tblA.ID
WHERE tblA.ID IS NULL

--
Ross Presser -- rpresser AT imtek DOT com
"... VB is essentially the modern equivalent of vulgar Latin in 13th Centurary Europe. Understand it, and
you can travel to places you never heard of and still understand some people." -- Alex K. Angelopoulos
Nov 12 '05 #3
Thanks everyone for the responses - much appreciated!

I've discovered that full outer joins are not supported in an access .mdb
(see:
http://office.microsoft.com/assistan...EC010553071033)

However, I was successful in creating the following, which solves my
problem:

SELECT tblTxAcct.TxAcct_ID, qryTxToQ1.Q1Total, qryTxToQ2.Q2Total,
qryTxToQ3.Q3Total, qryTxToQ4.Q4Total, qryTxToYr.YrTotal,
tblTxAcct.TxAcctName
FROM ((((tblTxAcct LEFT JOIN qryTxToQ1 ON tblTxAcct.TxAcct_ID =
qryTxToQ1.TxAcct_ID) LEFT JOIN qryTxToQ2 ON tblTxAcct.TxAcct_ID =
qryTxToQ2.TxAcct_ID) LEFT JOIN qryTxToQ3 ON tblTxAcct.TxAcct_ID =
qryTxToQ3.TxAcct_ID) LEFT JOIN qryTxToQ4 ON tblTxAcct.TxAcct_ID =
qryTxToQ4.TxAcct_ID) LEFT JOIN qryTxToYr ON tblTxAcct.TxAcct_ID =
qryTxToYr.TxAcct_ID;

I think I can use something like Nz(Q1Total,0) in the data sheet to populate
blank cells with zeros... but have not yet tried this...


"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
"deko" <dj****@hotmail.com> wrote in message

news:<WC****************@newssvr29.news.prodigy.co m>...
From what I understand, an Inner Join narrow the rows selected to the table with the least results... and an Outer Join does the opposite...

SELECT qryTxToQ1.Q1Total, qryTxToQ2.Q2Total, qryTxToQ3.Q3Total,
qryTxToQ4.Q4Total
FROM qryTxToQ4 OUTER JOIN (qryTxToQ3 OUTER JOIN (qryTxToQ1 OUTER JOIN
qryTxToQ2 ON qryTxToQ1.TxAcct_ID = qryTxToQ2.TxAcct_ID) ON
qryTxToQ3.TxAcct_ID = qryTxToQ2.TxAcct_ID) ON qryTxToQ4.TxAcct_ID =
qryTxToQ3.TxAcct_ID;

Is my syntax wrong? Or am I trying to do something that Access 2002 will not allow?


Access won't do the FULL OUTER JOIN that (I think) exists in Oracle.
You can do LEFT/RIGHT JOINs though. If you want to see the Access
syntax, create a query in the QBE grid with two related tables.
Right-Click on the join line and select either option 2 or 3 (both
outer joins). But those are LEFT or RIGHT, not FULL. I think to get
what you want, you may need to create the LEFT and RIGHT joins and
then UNION them together...

Okay, that's enough "thinking" for one day...

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Preston Landers | last post by:
Hello all. I am trying to write a query that "just" switches some data around so it is shown in a slightly different format. I am already able to do what I want in Oracle 8i, but I am having...
8
by: Matt | last post by:
Hello I have to tables ar and arb, ar holds articles and a swedish description, arb holds descriptions in other languages. I want to retreive all articles that match a criteria from ar and...
5
by: Harry Broomhall | last post by:
I wonder if anybody could give me a few pointers on a problem I face. I need to do an UPDATE on table A, from an effective left outer join on A and another table B. (This is trying to perform a...
4
by: Anthony Robinson | last post by:
I was actually just wondering if someone could possibly take a look and tell me what I may be doing wrong in this query? I keep getting ambiguous column errors and have no idea why...? Thanks in...
3
by: Ian Boyd | last post by:
i know nothing about DB2, but i'm sure this must be possible. i'm trying to get a client to create a view (which it turns out is called a "Logical" in DB2). The query needs a LEFT OUTER JOIN, but...
1
by: Bob Alston | last post by:
I am trying to use an access sql statement in a module that does a left outer join on one table - joined to a table that has a selection criteria. The result is an inner join. If I do this in...
3
by: Doug | last post by:
Hi, I'm more familiar with MSSQL than Access syntax and have run into a problem with correctly putting ( )'s around the joins in a 3 table query. I want to INNER JOIN lenders and accounts and...
5
by: Eitan M | last post by:
Hello, How can I do outer join in ms-access database ? Thanks :)
1
by: Eitan M | last post by:
Hello, I want to do left outer join in access 2002. 1) Isn't any way to do without the words "left outer join", like : table1.column1 = table2.column2 (+) that was the simple Oracle syntax, and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.