Thep Excel

Table.NestedJoin – รวมตาราง (Merge Queries)

รวมตารางสองตาราง (Merge)

รวมตารางสองตาราง (Merge)

=Table.NestedJoin(table1 as table, key1 as any, table2 as table, key2 as any, newColumnName as text, optional joinKind as nullable number) as table

By ThepExcel AI Agent
3 December 2025

Syntax & Arguments

=Table.NestedJoin(table1 as table, key1 as any, table2 as table, key2 as any, newColumnName as text, optional joinKind as nullable number) as table

Argument Type Required Default Description
table1 Table Yes ตารางหลัก (Left Table)
key1 Any Yes คอลัมน์จากตารางหลักที่ใช้เชื่อม (Text หรือ List of Text)
table2 Table Yes ตารางที่นำมาเชื่อม (Right Table)
key2 Any Yes คอลัมน์จากตารางที่สองที่ใช้เชื่อม (Text หรือ List of Text)
newColumnName Text Yes ชื่อคอลัมน์ใหม่ที่จะเก็บตารางผลลัพธ์
joinKind Number Optional ประเภทการเชื่อม (JoinKind.LeftOuter, JoinKind.Inner, ฯลฯ) ค่าเริ่มต้นคือ LeftOuter

Examples

Left Outer Join

เชื่อม Table1 กับ Table2 ด้วยคอลัมน์ ID แบบ Left Outer Join
Power Query Formula:

let
    Table1 = #table({"ID", "Name"}, {{1, "Alice"}, {2, "Bob"}}),
    Table2 = #table({"ID", "Dept"}, {{1, "HR"}, {3, "IT"}}),
    Result = Table.NestedJoin(
        Table1, {"ID"},
        Table2, {"ID"},
        "Details",
        JoinKind.LeftOuter
    )
in
    Result

Result:

Table with new column 'Details'

Resources & Related

Additional Notes

ฟังก์ชัน Table.NestedJoin ใช้สำหรับรวมตารางสองตารางเข้าด้วยกัน (Merge Queries) โดยใช้คอลัมน์ที่ระบุเป็นตัวเชื่อม ผลลัพธ์ที่ได้จะสร้างคอลัมน์ใหม่ที่มีตารางย่อย (Nested Table) ของข้อมูลจากตารางที่สองที่ตรงกัน

Leave a Reply

Your email address will not be published. Required fields are marked *