Loading TOC...

MarkLogic 12 EA 2 Product Documentation
ModifyPlan.prototype.joinCrossProduct

ModifyPlan.prototype.joinCrossProduct(
   rightPlan as String,
   [condition as xs.boolean]
) as ModifyPlan

Summary

This method yields one output row set that concatenates every left row with every right row. Matches other than equality matches (for instance, greater-than comparisons between keys) can be implemented with a condition on the cross product.

The join performs natural joins between columns with the same identifiers. To prevent inadvertent natural joins, specify a different qualifier for the left or right columns or use different column names for the left and right columns.

Parameters
rightPlan The row set from the right view.
condition A boolean expression that filters the join output rows. See Boolean Expression Functions for the list of functions used to build boolean expressions.

Usage Notes

joinCrossProduct is a method of the following classes:

Example

const op = require('/MarkLogic/optic');

const employees = op.fromView('main', 'employees');
const expenses = op.fromView('main', 'expenses');

const Plan =
    employees.joinCrossProduct(expenses)
             .where(op.eq(employees.col('EmployeeID'), expenses.col('EmployeeID')))
             .orderBy([employees.col('EmployeeID')])
    Plan.result();
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.