View Single Post
  #2  
Old May 26th, 2010, 07:21 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default union query without "blank" recordsl

Mark Kubicki wrote:

I have a union query between 2 related tables, and where they may be records
in one table [FixtureTypes] with no value in the other
[FixtureCatalogsPages ].
I've got this (below) query written, which successfully joins the 2;
however, it still provides a record when there is no match. I want the
query to provide ONLY records for where there is a match between the 2
tables.

I suspect I should be using some sort of property or filter?

SELECT FixtureTypes.Type, FixtureTypes.Manufacturer, FixtureTypes.CatalogNo
AS CatalogNumber, FixtureCatalogsPages.CatalogSheetLink,
FixtureCatalogsPages.printOrder
FROM FixtureTypes
LEFT JOIN FixtureCatalogsPages ON (FixtureTypes.CatalogNo =
FixtureCatalogsPages.CatalogNumber) AND (FixtureTypes.Manufacturer =
FixtureCatalogsPages.Manufacturer);


That is NOT a union query. A union query has more than one
SELECT statemenr with UNION or UNION ALL between them.

To avoid retrieving records from FixtureTypes when there is
no matching record in FixtureCatalogsPages, change the LEFT
JOIN to INNER JOIN

--
Marsh
MVP [MS Access]