Forum Discussion

Mike_Conroy's avatar
Mike_Conroy
Copper Contributor
Jul 20, 2020

Merging Queries with two inner joins

Hi,

 

I'm trying to merge two queries, but I need to do inner joins on two different columns in each query.  When I use the query editor, I can only merge on a single column.  Can I merge on two columns using M code.  Where can I find the syntax?

 

Thanks,

 

Mike

1 Reply

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Mike_Conroy 

    You may join on any number of columns. If in user interface, select two columns in first table, two columns in second table, and join.

     

    If you merge tables, that will be like

    = Table.NestedJoin(Table1, {"A", "B"}, Table2, {"X", "Y"}, "Table2", JoinKind.Inner)

    If use Table.Join when

    = Table.Join(Table1, {"A", "B"}, Table2, {"X", "Y"}, JoinKind.Inner)

    You may google for all parameters.

Resources