Suggestions on best way to merge data from two different tables? (1 Viewer)

Niroth

Registered User.
Local time
Yesterday, 22:44
Joined
Jul 12, 2007
Messages
81
Hi,

So I have two tables,

table1: (company_name, company_code, year_month, rating)
table2: (company_name, company_code, year_month, asset, debt, equity,...)

What I would like to do is to call up all the data in table1, and then call up (asset, debt, equity,...) from table2 where the company_code and year-month are equal. What do you think is the best way to do this? Keep in mind a few things:

1. I'm dealing with hundreds of thousands of data lines
2. I may need to get more data similiar to table2 in the future and call it up in the same way


I thought I should create a primary key "company_code-year_month"for both tables, but that method doesn't seem like a good one, and if I were to have another table, will have to create the same primary key for that table as well?

Please help.

Thanks for reading, and Happy New Year.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 15:44
Joined
Jan 20, 2009
Messages
12,852
Just use an ordinary select query to join the tables on the common fields.
 

Niroth

Registered User.
Local time
Yesterday, 22:44
Joined
Jul 12, 2007
Messages
81
Can you elaborate on how I can do that? What's the code for the select query?

Thanks.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 15:44
Joined
Jan 20, 2009
Messages
12,852
Build it in the query designer then look at the SQL view if you are interested. It is the default query that is made when you create a query.

You really need to study an Access primer to get started. A Select query is one of the most basic things one learns to do in Access.
 

Users who are viewing this thread

Top Bottom