訓練
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
根據 key1
(代表 table1
) 和 key2
(代表 table2
) 所選取索引鍵資料行的值是否相等,聯結 table1
與 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"]})]
})