Union

Union can help you combine two similarly structured tables vertically. That is, it is to append a table below another table, so it adds more rows to the original table. Generally, Union is used for two tables with the same or similar properties of columns.

Inputs

The Union action requires two pieces of inputs:

  • Table names that you want to append together

  • Columns names that allow the exact one to one mapping of each column from one table to the other

Acho will automatically recognize column names that are exactly matching from the two tables and assume that those are to be stacked together. However, if the naming convention from the two sides differs, some effort will need to be spent on specifying the mapping.

Union multiple tables

If you have multiple CSV files with exactly the same number of columns and column names, you can also try uploading them as Multiple CSV files. This method combines multiple CSV files as a single resource by using Union.

Modify the number of columns to map

If you don't want to append tables based on all columns, you can click the minus icon to remove the columns that you don't need. If you remove some of the columns accidentally, you can click the plus icon to get those columns back.

The maximum number of columns cannot exceed the number of columns in the first table. Take the above graph as an example. If the orders_Jan table has 3 columns, the maximum number of the columns that you can specify is 3 even if the order_Feb table has 4 columns.

Union Example

Below is a demo table called "customers" :

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

1

Alfred Futterkiste

Maria Anders

43 53rd Ave

New York

12209

USA

2

Ana Trujillo Emparedados y helados

Ana Trujillo

Avda. de la Constitución 2222

México D.F.

05021

Mexico

3

Antonio Moreno Taquería

Antonio Moreno

Mataderos 2312

México D.F.

05023

Mexico

and another demo table called "suppliers":

SupplierID

SupplierName

ContactName

Address

City

PostalCode

Country

1

Exotic Liquid

Charlotte Cooper

49 Gilbert St.

London

EC1 4SD

UK

2

New Orleans Cajun Delights

Shelley Burke

P.O. Box 78934

New Orleans

70117

USA

3

Grandma Kelly's Homestead

Regina Murphy

707 Oxford Rd.

Ann Arbor

48104

USA

By applying the Union action, you would need to provide the column mapping between these two tables. Also, make sure that all column types match well. For example, a string column can only be merged with a String column.

Below is the result table after Union. As indicated, ContactName, Address, City, PostalCode, and Country are now merged.

ContactName

Address

City

PostalCode

Country

Maria Anders

43 53rd Ave

New York

12209

USA

Charlotte Cooper

49 Gilbert St.

London

EC1 4SD

UK

Regina Murphy

707 Oxford Rd.

Ann Arbor

48104

USA

Shelley Burke

P.O. Box 78934

New Orleans

70117

USA

Ana Trujillo

Avda. de la Constitución 2222

México D.F.

5021

Mexico

Antonio Moreno

Mataderos 2312

México D.F.

5023

Mexico

Troubleshooting

  • Why some of the rows are duplicated?

The Union action uses UNION ALL function in SQL. It appends all data points from one dataset to another dateset no matter whether some rows are duplicated. If you don't want to have duplicated records, you can use the deduplicate function to filter out redundant rows.

Last updated