> ## Documentation Index
> Fetch the complete documentation index at: https://docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, but they are separate products. Do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers four products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, and the GraphRAG SDK. Name which one an answer applies to, since setup and operations differ.

# UNION

> Combine results from multiple Cypher queries using the UNION clause. Use UNION ALL to keep all rows or UNION to remove duplicates from the combined result set.

The UNION clause is used to combine the result of multiple queries.

UNION combines the results of two or more queries into a single result set that includes all the rows that belong to all queries in the union.

The number and the names of the columns must be identical in all queries combined by using UNION.

To keep all the result rows, use UNION ALL.

Using just UNION will combine and remove duplicates from the result set.

```sh theme={null}
GRAPH.QUERY DEMO_GRAPH
"MATCH (n:Actor) RETURN n.name AS name
UNION ALL
MATCH (n:Movie) RETURN n.title AS name"
```

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What is the difference between UNION and UNION ALL?">
    **UNION** combines results and removes duplicates. **UNION ALL** keeps all rows including duplicates, which is typically faster since no deduplication is needed.
  </Accordion>

  <Accordion title="Do column names need to match in UNION queries?">
    Yes. The number and names of columns must be identical across all queries combined with UNION. Use `AS` aliases to ensure column names match.
  </Accordion>

  <Accordion title="Can I use ORDER BY with UNION?">
    ORDER BY can be applied to the final combined result set after the UNION. Each individual query in the union cannot have its own ORDER BY unless wrapped in a CALL \{} subquery.
  </Accordion>
</AccordionGroup>
