Merging Queries with two inner joins

%3CLINGO-SUB%20id%3D%22lingo-sub-1533891%22%20slang%3D%22en-US%22%3EMerging%20Queries%20with%20two%20inner%20joins%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1533891%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%20to%20merge%20two%20queries%2C%20but%20I%20need%20to%20do%20inner%20joins%20on%20two%20different%20columns%20in%20each%20query.%26nbsp%3B%20When%20I%20use%20the%20query%20editor%2C%20I%20can%20only%20merge%20on%20a%20single%20column.%26nbsp%3B%20Can%20I%20merge%20on%20two%20columns%20using%20M%20code.%26nbsp%3B%20Where%20can%20I%20find%20the%20syntax%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMike%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1533891%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Visitor

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
Highlighted

@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.