Table.NestedJoin
Table.NestedJoin(table1 as table, key1 as any, table2 as any, key2 as any, newColumnName as text, optional joinKind as nullable number, optional keyEqualityComparers as nullable list) as table
基于 table1
(对于 table2
)和 key1
(对于 table1
)所选择的键列的值的相等性,联接 key2
的行与 table2
的行。 结果会输入到名为 newColumnName
的列中。
可选的 joinKind
指定要执行的联接类型。 默认情况下,如果未指定 joinKind
,则执行左外部联接。
可能包含一组可选的 keyEqualityComparers
以指定如何比较键列。 此 keyEqualityComparers
功能目前仅供内部使用。
使用单个键列联接两个表。
使用情况
Table.NestedJoin(
Table.FromRecords({
[CustomerToCall = 1],
[CustomerToCall = 3]
}),
{"CustomerToCall"},
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
}),
{"CustomerID"},
"CustomerDetails"
)
输出
Table.FromRecords({
[CustomerToCall = 1, CustomerDetails = Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]})],
[CustomerToCall = 3, CustomerDetails = Table.FromRecords({[CustomerID = 3, Name = "Paul", Phone = "543-7890"]})]
})