Re: Queries returning blank lines with joined tables

From: Roger Carlson (NO-Rog3erc-SPAM_at_hotmail.com)
Date: 02/07/05


Date: Mon, 7 Feb 2005 13:04:54 -0500

A RIGHT JOIN *is* an outer join. So is a LEFT JOIN. The difference is in
which one will display ALL of the record. The RIGHT JOIN will use the table
on the Right of the Join equation:
   ON Servers.ID = NIC.ID
So your query is showing all of the records in NIC and related records from
Servers. You want it the other way around. Therefore, you want a LEFT
JOIN. So simply change RIGHT to LEFT, and it should work.

-- 
--Roger Carlson
  Access Database Samples: www.rogersaccesslibrary.com
  Want answers to your Access questions in your Email?
  Free subscription:
  http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
"Jag" <Jag@discussions.microsoft.com> wrote in message
news:F0691C5B-C30E-4816-A221-436DCDC29805@microsoft.com...
> I have looked at others having this same issue and can't make anything
work
> to produce all ruecords when I run the query.
> The SQL query is this...
> SELECT Servers.Host, Servers.ID, NIC.IPAddress, NIC.MACAddress, NIC.NICID
> FROM Servers RIGHT JOIN NIC ON Servers.ID = NIC.ID
> ORDER BY Servers.ID;
> Basically Servers table has all records in it and a NICID in some records,
I
> am trying to querey all records but all blank NICID recrords are dropped.
I
> have seen others talk about an outer join but that isn't available to me
or I
> am doing something wrong.  The help system references using NZ but when I
try
> that in the criteria it doesn't work at all for me.  How do I display all
> records even those with null values?
>
> Thanks
>


Relevant Pages

  • Re: A pretty easy one for the experts
    ... Sounds like you need to use an outer join. ... > I'm trying to do a query incorporating three different ... now I want to add the test information for each ... it won't display any info. ...
    (microsoft.public.access.queries)
  • Re: Need Help to Display all Records for a query
    ... You need to use an outer join to show the records without changes ... I am running a query against 2 tables, change and employee. ... I would like those records to display in ...
    (microsoft.public.access.queries)
  • Re: Display Group Header with No Data For Group
    ... The report is based on a query, but the issue is that it is grouped by stages ... but I need to display the group headers for all groups. ... outer join). ...
    (microsoft.public.access.forms)
  • Re: NZ function - cant get to work
    ... Use a outer join ... tables together (AllianceMgr is the primary key on the AMContacts table). ... I'm trying to do a query that combines all of this data together so I can ... when I do the query it doesn't display any of those records. ...
    (microsoft.public.access.queries)
  • Left Outer Join: Index Seek not providing all index columns
    ... We have a left outer join query which is intended to prove ... The wrinkle is that the SQL Server 2000 query optimizer is generally ... left outer join entextractitems eei ...
    (microsoft.public.sqlserver.server)