Inner join between two tables or timetables
creates the table or timetable, T
= innerjoin(Tleft
,Tright
)T
, as the inner
join of Tleft
and Tright
using
key variables. All
variables with the same names in both inputs are key variables. An inner join
combines rows where the key variables have matching values. For example, if
Tleft
has variables named Key1
and
Var1
, and Tright
has variables
Key1
and Var2
, then
T=innerjoin(Tleft,Tright)
uses Key1
as a
key variable.
The matching values of the key variables in the left and right tables do not have to be in the same order. Inner joins can perform one-to-many and many-to-one matches between the key variables of the two tables. That is, a value that occurs once in a key variable of the left table can have multiple matches in the right table. Similarly, a value that occurs once in a key variable of the right table can have multiple matches in the left table.
You can perform inner joins only on certain combinations of tables and timetables.
If Tleft
is a table, then Tright
must be a table. innerjoin
returns T
as a table.
If Tleft
is a timetable, then Tright
can be either a table or a timetable. innerjoin
returns
T
as a timetable for either combination of
inputs.
The vectors of row labels of Tleft
and Tright
can be key
variables. Row labels are the row names of a table, or the row times of a
timetable.
performs the inner-join operation with additional options specified by one or more
T
= innerjoin(Tleft
,Tright
,Name,Value
)Name,Value
pair arguments.
For example, you can specify the variables to use as key variables.
The vector of row labels from an input table or timetable can be a key, alone
or in combination with other key variables. Row labels are the row names of a
table or the row times of a timetable. To use this vector as a key, specify it
as 'Row'
(for the row names of a table), as the name of a
timetable vector of row times, or as the value of
,
where T
.Properties.DimensionNames{1}
is the table or
timetable.T
In general, innerjoin
copies row labels from the input
table Tleft
to the output table T
.
If Tleft
has no row labels, then
T
has no row labels.
If Tleft
has row labels, then
innerjoin
copies row labels from
Tleft
to create row labels in
T
.
However, if both Tleft
and
Tright
are tables, but you do not specify
either input table’s row names as a key, then
innerjoin
does not create row names in
T
.
You cannot perform an inner join using the row labels of
Tleft
as the left key and a variable of
Tright
as the right key. To perform the inner join,
convert the row labels of Tleft
to a table variable and use
the new table variable as a key.
join
| Join
Tables | outerjoin