Functions Utility

MultiJoin

The MultiJoin() function combines rows from multiple data ranges into a single range. It works similarly to the JOIN functionality in SQL (Structured Query Language), which is used for querying databases.

Related function: Join


Syntax:

Qx.MultiJoin(Query, Range 1, Range 2, Range 3 … Range 16)
  • In Excel with Quintessence add-in versions prior to 25.1, use: MultiJoin()
  • In the Quintessence Editor (Studio) using Quintessence language, use: MultiJoin()
  • In the Quintessence Editor (Studio) using Python language, use: Qx.MultiJoin()
 See parameter descriptions

QuerySpecify the columns to select from one or more ranges, the type of join to
perform, and the criteria on which to join the ranges. The available join types are:
• Inner
• Left
• Right

See examples below.
Range nThe ranges to join are determined based on the criteria specified by the
Query parameter value.

Examples:

The examples provided below are based on fictitious data for illustrative purposes only.

> Example 1: Left and right join on multiple columns


Table1 (A1:B7):

StockDate
AAA1-Jan-17
AAA2-Jan-17
BBB1-Jan-17
BBB2-Jan-17
CCC1-Jan-17
CCC2-Jan-17


Table2 (D1:F5):

StockDateHoldings1
AAA1-Jan-17100
AAA2-Jan-17101
CCC1-Jan-1750
DDD1-Jan-1720

Table3 (H1:J5):

StockDateHoldings2
AAA1-Jan-17200
AAA2-Jan-17201
BBB1-Jan-1710
CCC1-Jan-1745

Join sequence and Query:

Left join Table2 to Table1:
Returns all matched rows plus all unmatched rows from Table1 on Stock and Date, returning Stock and Date from Table1 and Holdings1 from Table2:

select
	Table1.C1, Table1.C2, Table2.C3
from
	Table1
left join
	Table2 on Table2.C1 = Table1.C1 and Table2.C2 = Table1.C2

Right join Table3 to Table1:
Returns all matched rows plus all unmatched rows from Table3 on Stock and Date, adding Holdings2 to the result:

select
	Table1.C1, Table1.C2, Table2.C3, Table3.C3
from
	Table1
left join
	Table2 on Table2.C1 = Table1.C1 and Table2.C2 = Table1.C2
right join
	Table3 on Table3.C1 = Table1.C1 and Table3.C2 = Table1.C2

MultiJoin() call:

=Qx.MultiJoin(Query, A2:B7, D2:F5, H2:J5)

Result:

AAA1-Jan-17100200
AAA2-Jan-17101201
BBB1-Jan-1710
CCC1-Jan-175045
> Example 2: Inner join


Table1 (A1:B4):

StockPrice
AAA100
BBB200
DDD400

Table2 (D1:E4):

StockName
AAAAAA Stock
BBBBBB Stock
CCCCCC Stock

Query:

select
	Table2.C2, Table1.C2
from
	Table1
inner join
	Table2 on Table2.C1 = Table1.C1

This inner join returns only rows where Stock exists in both tables and retrieves the Name from Table1 and Price from Table2.

=Qx.MultiJoin(Query, A2:B4, D2:E4)

Result:

AAA Stock100
BBB Stock200