Loading TOC...

op:union

op:union(
   $leftPlan as map:map,
   $rightPlan as map:map
) as map:map

Summary

This method yields all of the rows from the input row sets. Columns that are present only in some input row sets effectively have a null value in the rows from the other row sets.

This method is often followed by the op:where-distinct modifier.

Parameters
$leftPlan The row set from the left view.
$rightPlan The row set from the right view.

Example

import module namespace op="http://marklogic.com/optic"
     at "/MarkLogic/optic.xqy";

let $employees := op:from-view("main", "employees")
let $expenses  := op:from-view("main", "expenses")

return $employees
   => op:union($expenses)
   => op:where-distinct()
   => op:order-by(op:view-col("employees", "EmployeeID"))
   => op:result()
  

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