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

SELECT WHERE Field Names from 2 tables are equal

Status
Not open for further replies.

Rascelon

Technical User
Mar 26, 2005
12
US
Is it possible to select fields from two tables where the field names are equal?

I know that the field data types are all the same but I want to make a query that contains data where the field names are the same in both tables.
Vince
 
you'd just put the table name along with the field name... ie. table1.fieldname and table2.fieldname in your query

_______
I love small animals, especially with a good brown gravy....
 
Sorry for not being clear but I wouldn't know what the field names would be.
My guess is that this isn't possible simply using SQL but I can do it using procedural code in Access (VBA), which is what I am working on now.
Thanks anyway.
Vince
 
Well, I do a similar thing all the time. But it's a web based application. When someone creates a "Document Type", it creates the appropriate tables (which I don't know the name of ahead of time) and then it creates Fields (which I don't know ahead of time either).

What I do is to put the names into a table that I call "TableDef". In there I store all the names of the fields and the tables that they go to as well as the data types that the fields are, ie. integer, character, length(when appropriate), etc.

Hope that helps

_______
I love small animals, especially with a good brown gravy....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top