Merging tables

  • Thread starter Martin A. Weinberger
  • Start date
M

Martin A. Weinberger

Hi all,

I have 5-tables that I want to combine. My first thought on a query was

SELECT Table1.*, Table2.*, Table3.*, Table4.*, Table5.* FROM Table1, Table2,
Table3, Table4, Table5 WHERE (Table1.lIDPrimary > 0);

The problem with this statement is that I get no rows back and not all data
from all tables. I was told that the query above is an INNER JOIN and I want
to use an OUTER JOIN. How do I create a query that returns all the rows?

Thanks in advance,
 
L

Lynn Trapp

Your query uses neither an INNER Join or an OUTER Join and it will return
what is called a Cartesian product -- One row for every row in every table
multiplied by the number of rows in every table. If you have the following:

Table1 - 5 rows
Table2 - 6 rows
Table3 - 2 rows
Table4 - 4 rows
Table5 - 8 rows

Then you should see a return of 1920 rows.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Big List: www.ltcomputerdesigns.com/JCReferences.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top