Use UNION
to combine the results of two queries into a single query.
Usage
With UNION
, the unique results from both queries will be returned. If you include the ALL
option, the results found in both queries will be duplicated.
Examples
Example 3-15 shows how to use this JPQL extension.
Example 3-15 Using UNION EQL
SELECT MAX(e.salary) FROM Employee e WHERE e.address.city = :city1 UNION SELECT MAX(e.salary) FROM Employee e WHERE e.address.city = :city2
See Also
For more information, see: