Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2007

Tip: Looking for answers? Try searching our database.

Outer join not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kissybean - 12 Nov 2007 20:16 GMT
Hi All,

I have a problem doing an outer join between two tables.  They are regular
access tables.  I have read through all the questions and answers for the
topic and tried various things but still it will not work.

Table 1 has 205 records.  I want to join with table 2 on an ID field.  I have
3 criteria on table 2.  I included the null clauses in various syntax's to no
avail.

Here is the query:

SELECT a.*, b.Rate
FROM [Provider Trend Rate Final] AS b RIGHT JOIN [Trend Projections - Step 1]
AS a ON b.Provider_ID = a.[Prov ID]
WHERE (((b.Product_Line)='COM') AND ((b.Type)='B') AND ((b.IP_OP)='IP')) OR (
((b.Product_Line) Is Null) AND ((b.Type) Is Null) AND ((b.IP_OP) Is Null));

This gets me 154 rows which is not correct.  I want 205 rows.

Can anyone help?

Thanks!
Michel Walsh - 12 Nov 2007 21:08 GMT
A RIGHT JOIN preserve the table mentioned to the right of that word, here,
table "a",  not table "b".

Vanderghast, Access MVP

> Hi All,
>
[quoted text clipped - 24 lines]
>
> Thanks!
kissybean - 12 Nov 2007 21:27 GMT
>A RIGHT JOIN preserve the table mentioned to the right of that word, here,
>table "a",  not table "b".
[quoted text clipped - 6 lines]
>>
>> Thanks!

Sorry, I meant that.... I have re-arranged this so many times... but the
point is the same... it doesn't work.
Michel Walsh - 13 Nov 2007 14:13 GMT
If you remove the WHERE clause, the number of returned records is ok?

Your WHERE clause handles the NULL coming from the join (if you use :  FROM
a LEFT JOIN b ON ... WHERE b.f1=something OR b.f1 IS NULL), ***but*** still
REMOVES rows with a match that are such that b.f1=something. That is why you
may look at the result WITHOUT the where clause to see if the join is the
problem, or if it is not the where clause (which is logically executed after
the join).

Hoping it may help,
Vanderghast, Access MVP

>>A RIGHT JOIN preserve the table mentioned to the right of that word, here,
>>table "a",  not table "b".
[quoted text clipped - 9 lines]
> Sorry, I meant that.... I have re-arranged this so many times... but the
> point is the same... it doesn't work.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.