One query two tables

DeanW

New member
Local time
Today, 08:28
Joined
Feb 18, 2007
Messages
2
I want to create one query from two tables. When I run the query with two table the data sheet is blank. How do I combine two tables so when I run one query all records appear from both tables?
 
What does the query look like?
What are the table structures?
What field(s) link(s) the two tables?
 
One Query two tables

To get data from a query you need to add fields from the tables to the output Fields in the bottom section of the designer. To get all the fields from a table drag the '*' field from the table to the row labeled 'Field'.
If you put two tables in the query window and don't link or 'join' them up in any way you will get an output with every row in Table1 together with every row in Table2. E.g. if table1 has 10 rows and table2 has 20 rows you will get 10x20 = 200 rows. Joining is complicated so best search in the help for "query join"
 
How do I combine two tables so when I run one query all records appear from both tables?
If you want to view records from two separate tables in one query, use UNION (or UNION ALL). Syntax is...
Code:
SELECT() FROM()

UNION (ALL)

SELECT() FROM()
It is important to note too, that JOINS are meant to combine FIELDS, whereas UNION is meant to combine RECORDS.
Also, UNION can only be performed when queried records from tables contain the same number of fields.
 
hehe this thread makes me smile.. its like me saying my hand hurts? why....
 
one query two tables

Thanks for all your help I got the problem solved.
 

Users who are viewing this thread

Back
Top Bottom