613-518-1166 info@zimdatabases.com

ZIM Language Reference

UNION

< All Topics

UNION

Combines the members of two or more result sets into a single set.

Syntax

set1 UNION set2

Parameters

set1 The name of a result set that resulted from the execution of a set-producing command.
Set1 and set2 must have the same component structure.
set2 The name of a result set that resulted from the execution of a set-producing command.
Set1 and set2 must have the same component structure.

Comments

When used within a FIND command, the set that results from the application of UNION contains all of the records from the specified sets, with duplicates being eliminated.

The sets must have the same component structure.

Example

find Employees (unrelated) WorkFor Managers keep Employees

find current (Employees -> Managers) -> MgrSet

% top level managers

find Employees WorkFor MgrSet keep Employees -> EmpSet

while

find Employees WorkFor EmpSet (Employees -> Managers) -> EmpMgrSet

if $setcount = 0

break

endif

find EmpMgrSet keep Managers -> NewMgrSet

find MgrSet union NewMgrSet -> MgrSet

endwhile

While the preceding program demonstrates the use of UNION, the program can be replaced with the single command shown below.

find Employees WorkFor Managers keep Managers -> MgrSet

See Also

INTERSECT

MINUS

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents