Primary Table and Archive Combine

jglassner

New Member
Joined
Apr 28, 2016
Messages
31
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello

Before I ask the question I know if I had not created and archive table from my primary table I would not have this issue. However, offloading years of data that is not used all that much really sped things up.

So, now I been asked to run a report for the life of the project and I need to combine the data while keeping the tables separate. I am looking to combine certain data fields to get a count of the total. Both tables are exactly the same.

Example
Primary Table Project Date + Primary Archive Project Date.

I assume a query would be the answer but I can not seem to get the two tables to merge.

Thanks,
Jason
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

JonXL

Active Member
Joined
Feb 5, 2018
Messages
470
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
You want a UNION query. Something like...

SQL:
SELECT FIELD1, FIELD2
FROM ACTIVE_TABLE
UNION ALL
SELECT FIELD1, FIELD2
FROM ARCHIVE_TABLE

Save this as a query and then create new queries referencing it to pull all the reporting.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,703
Office Version
  1. 365
Platform
  1. Windows
so why you want to merge these two?
I'm just asking out of curiosity
I am pretty sure that they mean the table structures, not the table data.
 

sandy666

Banned - Rules violations
Joined
Oct 24, 2015
Messages
7,497

ADVERTISEMENT

I am pretty sure that they mean the table structures, not the table data.
this is just your interpretation, I don't see the confirmation / denial from OP 😇
 

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,836
Office Version
  1. 2019
Platform
  1. Windows
I would imagine JonXL is on the right track...

Note: UNION vs UNION ALL could make a difference. UNION by default will discard duplicates which may affect your count if there are duplicates...
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,703
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

this is just your interpretation, I don't see the confirmation / denial from OP
I think it can be pretty easily inferred, if you read the entire question in its context.
...However, offloading years of data that is not used all that much really sped things up.

So, now I been asked to run a report for the life of the project and I need to combine the data while keeping the tables separate.
 

Micron

Well-known Member
Joined
Jun 3, 2015
Messages
2,133
Office Version
  1. 365
Platform
  1. Windows
I think it can be pretty easily inferred, if you read the entire question in its context.
Sometimes, only a part of it can be relied on. I'd defer to this statement as the rest is not crystal clear:
I need to combine the data while keeping the tables separate.
which I take to mean that data is to be temporarily merged as a query would do.
 

jglassner

New Member
Joined
Apr 28, 2016
Messages
31
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
You want a UNION query. Something like...

SQL:
SELECT FIELD1, FIELD2
FROM ACTIVE_TABLE
UNION ALL
SELECT FIELD1, FIELD2
FROM ARCHIVE_TABLE

Save this as a query and then create new queries referencing it to pull all the reporting.


THANK YOU
 

Watch MrExcel Video

Forum statistics

Threads
1,133,573
Messages
5,659,603
Members
418,513
Latest member
TWEagle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top