Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One report from muliple tables

Status
Not open for further replies.

missangie

Technical User
Nov 3, 2002
51
This is probably an easy one but I can't seem to figure it out. I need to pull info from two tables into one report. How is this done?
Thanks in advance!
Angie
 
With a query.

e.g. Select *
From table1, table2
where table1.field = table2.field

This is only an example & queries can get a lot more complex.

Reagrds
Warwick Regards
Warwick
 
You may be looking for a Union Query. This allows you to list records from more than one table in a single query within the same fields. example:

SELECT ALL [Field1], [Field2]
from Table1

UNION ALL SELECT [Field1], [Field2]
from Table2
ORDER BY [Field1];

if Table 1 looks like:

Field 1 Field 2
1 abc
2 def

and Table 2 looks like:

Field 1 Field 2
8 uvw
9 xyz

Then the Union query returns

Field 1 Field 2
1 abc
2 def
8 uvw
9 xyz

This is a simple example. You can add WHERE statements and even combine fileds that do not have the same name with the SELECT... AS statement.

I hope this helps.

BAKEMAN [Pimp]
 
Ahh, perfect... Thanks so much for your help. It's working great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top