Primary Table and Archive Combine

jglassner

New Member
Joined
Apr 28, 2016
Messages
31
Office Version
365
Platform
Windows, 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
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

JonXL

Active Member
Joined
Feb 5, 2018
Messages
344
Office Version
365, 2016
Platform
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
53,666
Office Version
365
Platform
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

Well-known Member
Joined
Oct 24, 2015
Messages
5,830
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, Moderator
Joined
Mar 2, 2007
Messages
16,675
Office Version
2013
Platform
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
53,666
Office Version
365
Platform
Windows
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
1,855
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
365
Platform
Windows, 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,102,561
Messages
5,487,563
Members
407,605
Latest member
PACULA

This Week's Hot Topics

Top