Forum Discussion
Union two tables with different columns names
- 9 years ago
Hi Ohad,
In this scenario, you can also try the Append Queries option in Query Editor.:smileyhappy:
1. Rename the three columns in Table B with the column names in Table A.
2. Select Table A, and choose "Append Queries as New" under Home tab in Query Editor.
Regards
Thanks for the reply.
I didn't mention that in each table I have a few more columns that are not relevant to table C (table A - 27 columns in total and table B - 13 columns in total) but the union can work only if the two tables are with the same number of columns, any idea?
Also, how do I set which column in table A to join with column in table B? (they are not in the same order).
Thanks.
- rocky099 years ago
Solution Sage
I see. But, you haven't even mentioned that you have different columns in each table.
If you have these tables in Excel. What I could do is I will create a New Sheet in excel, Make the Column headings and paste the relevant columns accordingly.
If the data is fetching from Database. I think, you need to write a query while fetching the data.
Otherwise, Suppose, you want only some fields in both tables. What you can do it, Right Click on the Table --> Edit Query --> Delete the Columns which you don't want. So, Finally, you can use Union Query.
Check this LINK
- MarcelBeug9 years ago
Community Champion
It looks like you found yourself a good reaon for a Power Query solution: so rename the columns before combining the tables as outlined in my previous post.