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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One Query - Multi Tables

Status
Not open for further replies.

xlStar

Technical User
Nov 16, 2003
55
GB
Is there a way to have one query to work on many table with same column names where the table name only differ by number?

For example...Table Name..

Table1
Table2
Table3

all have column column names, so on the query can I add a parameter to the Table name like

FROM Table[MyNo]

I just wanted one query and use the Macro to control using 1, 2 or 3?
 
Select *, 1 As Tablenum from Table1
union
Select *, 2 As Tablenum from Table2
union
Select *, 3 As Tablenum from Table3
where Tablenum = [please enter Tablenum ]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top