SQL 2023 · Joins and combining queries

Stack two result sets

Combine rows from two queries and remove duplicates. UNION ALL keeps duplicates and is faster.

SELECT email FROM customers UNION SELECT email FROM leads;

Official SQL 2023 documentation

More joins and combining queries commands

All joins and combining queries commands · SQL 2023 cheatsheet

Was this page helpful?