Syntax

SQL Combine Results with UNION Syntax

In SQL, combine results with union: stacks results of two queries, removing duplicates — SELECT email FROM a UNION SELECT email FROM b;

Quick Answer

Syntax
SELECT email FROM a UNION SELECT email FROM b;
SQLSyntax

Combine Results with UNION

Code example
SELECT email FROM a UNION SELECT email FROM b;

Stacks results of two queries, removing duplicates.

Learn More

How to combine results with union in SQL

  1. Open your SQL file or editor.
  2. Copy the example, then replace its sample names and values for your code.

SQL Combine Results with UNION Syntax

Use SELECT email FROM a UNION SELECT email FROM b;.

Related Syntax References

Frequently asked questions

What is the SQL syntax for combine results with union?

Use this pattern: SELECT email FROM a UNION SELECT email FROM b;

Can I copy this SQL code example?

Yes. Use Copy code and adapt the example to your program.

Is this SQL syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify