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

3 Identical tables need to be combined

Status
Not open for further replies.

NeedToKnow2

IS-IT--Management
Joined
Aug 31, 2003
Messages
3
Location
AU
Hi Guys,
I have a problem with creating a query from 3 identical tables. I have 3 sites with 3 databases which are identical but contain different data for each site. I need to create a reporting database that links the 3 tables which will enable me to run queries. Because all 3 are using identical keys it won't allow me to run the queries that I require. At least I think thats what is happening. The data at all sites are changing everyday thats why I have linked the all tables so the data is current.

I would very much appreciate any help you could give me please!
 
IF you are suggesting that each of the three tables has an AutoNumber primary Key field which is clashing when you combine the then can you live without the PrimaryKey field in the Report output ?

Given that you have the three tables linked into your front end app then you can use a UNION query of the form

SELECT fieldlist FROM Table1 WHERE whereclause
UNION
SELECT fieldlist FROM Table2 WHERE whereclause
UNION
SELECT fieldlist FROM Table3 WHERE whereclause


'ope-that-'elps.









G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Rename the tables using the AS in the Query SQL.
Ex. Select[Companyname] AS [Supplier/customer Name],[City] from [Suppliers]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top