There are 3 types of joins (or merging) that you can use to combine your reports in Wink Reports: inner, left and union. Wink finds all the columns in both reports which have the same names, and then match the rows to each other if all the values in these common columns are the same.
For instance if both reports have a "Date" and a "Customer Name" column, then the resulting report will merge the rows of both for each unique matching combination of "Date" and "Customer Name".
|Inner||When you use an inner join to combine reports, the result is a table that contains columns that have matches in both reports.
When you use a left join to combine reports, the result is a table that contains all values from the left report and corresponding matches from the right one.
When a value in the left table doesn't have a corresponding match in the right table, you see a null or empty value in the merged report.
|Union||Union is another method for combining two or more reports by appending rows of data from one table to another vertically. Ideally, the reports that you union have the same number of columns, and those columns have matching names and data types.|
What Is the Difference Between a Join and Union?
Joins and Unions can be used to combine data from one or more reports. The difference lies in how the data is combined.
In simple terms, joins combine data into new columns. If two reports are joined together, then the data from the first report is shown in one set of columns alongside the second reports’s columns in the same row.
Unions combine data into new rows. If two reports are “unioned” together, then the data from the first report is in one set of rows, and the data from the second report in another set. The rows are in the same result.
Here is a visual depiction of a join. Table A and B’s columns are combined into a single result.
Joins Combine Columns
Each row in the result contains columns from BOTH table A and B. Rows are created when columns from one table match columns from another. Wink uses all columns with the same title to match on.
This makes joins really great for looking up values and including them in results.
Now compare the above depiction with that of a union. In a union each row within the result is from one report OR the other. In a union, columns aren’t combined to create results, rows are combined.
Unions Combine Rows
Unions are typically used where you have two reports whose rows you want to include in the same result. A use case may be that you have two reports: Employees and Contractors. You would like to create a master list of names and hours worked sorted by date.
To do this you can use a union to first combine the rows into a single result and then sort them.