The join prefix joins the loaded
table with an existing named table or the last previously created data table.
Syntax:
[inner | outer | left | right ]Join[ (tablename )
]( loadstatement | selectstatement )
The join is a natural join made
over all the common fields. The join statement
may be preceded by one of the prefixes inner,
outer,
left or
right.
Arguments:
Arguments
Argument
Description
tablename
The named table to be compared to the loaded table.
loadstatement or selectstatement
The LOAD or SELECT statement for the loaded table.
Example:
Join SELECT
* from table1;
tab1:
LOAD * from
file1.csv;
tab2:
LOAD * from
file2.csv;
.. .. ..
join (tab1)
LOAD * from file3.csv;
Load script
Add the example script to your app and run it. Then add the fields listed in the results column to a sheet in your app to see the result.
Table1:
Load * inline [
Column1, Column2
A, B
1, aa
2, cc
3, ee ];
Table2:
Join Load * inline [
Column1, Column3
A, C
1, xx
4, yy ];
For more information about using inline loads, see Inline loads.
Resulting table
Column1
Column2
Column3
A
B
C
1
aa
xx
2
cc
-
3
ee
-
4
-
yy
Explanation
In this example, the two tables, Table1 and Table2, are merged into a single table labeled Table1. In cases like this, the join prefix is often used to join several tables into a single table to perform aggregations over the values of a single table.