UNION

External Article

UNION vs. UNION ALL in SQL Server

  • Article

Sometimes there is a need to combine data from multiple tables or views into one comprehensive dataset. This may be for like tables within the same database or maybe there is a need to combine like data across databases or even across servers. I have read about the UNION and UNION ALL commands, but how do these work and how do they differ?

2019-12-05

Technical Article

Union Forcing Distinct

  • Script

The use of union would seem to force a distinct in each of the select statements being unioned. The use multiple unions, with mixed union and union all clauses, seems to cause haphazard results.

1.67 (3)

2013-05-14 (first published: )

908 reads

Blogs

SQL Homework – July 2022 – Update your resume.

By

Resumes have been on my mind a lot recently. I’ve been thinking that I...

A Blogging Break

By

Outside of coping tips, I’m gonna take a break from blogging. I’ve been aiming...

Extended Events for Anything But Query Tuning: Unique Constraint Violations

By

Most of the time when I talk about or demo Extended Events, I spend...

Read the latest Blogs

Forums

Establishing a Connection to PostgreSQL with GoLang

By sabyda

Comments posted to this topic are about the item Establishing a Connection to PostgreSQL...

Azure Data Lake Storage Gen 2

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Azure Data Lake Storage Gen...

Be Smart

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Be Smart

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers