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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
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.
 
Upvote 0
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...
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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
Back
Top