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)

You rated this post out of 5. Change rating

2013-05-14 (first published: )

915 reads

Blogs

Migrate datetime data to datetimeoffset with AT TIME ZONE

By

I recently reviewed, worked on, and added a similar example to the DATETIMEOFFSET Microsoft...

The Comprehensive Guide to Mastering Your SQL DBA Skills

By

Database administrators (DBAs) are the backbone of data-driven organizations. If you're looking to break...

Friday Basics: Authentication vs. Authorization

By

Another security fundamentals topic is authentication versus authorization. For those who have a clear...

Read the latest Blogs

Forums

The Backup File Extension

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The Backup File Extension

Ingest and Retrieve data from an ADX Cluster Using Python

By Sucharita Das

Comments posted to this topic are about the item Ingest and Retrieve data from...

The DBAccountant

By Steve Jones - SSC Editor

Comments posted to this topic are about the item The DBAccountant

Visit the forum

Question of the Day

The Backup File Extension

I run this command in SQL Server 2022. What is the extension of the backup file?

BACKUP DATABASE HerdofTwo TO DISK = 'HerdOfTwo_20240501'

See possible answers