Aug 14

SQL SERVER – Difference Between Union and Union All


SQL SERVER – Difference Between Union and Union All



The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type. With UNION, only distinct values are selected.




The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.


The difference between Union and Union all is that Union all will not eliminate duplicate rows, instead it just pulls all rows from all tables fitting your query specifics and combines them into a table.

A UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records returned are unique from your union, use UNION ALL instead, it gives faster results.

Permanent link to this article:


1 ping

Skip to comment form

  1. Nice work

  2. looking forward to see more knowledgeable posts like this…

    • whatsapp for pc on August 31, 2013 at 11:58 am
    • Reply

    Terrific article! That is the type of info that are meant to be shared
    around the web. Disgrace on Google for no longer positioning this put up
    higher! Come on over and consult with my site .
    Thanks =)

    • candy crush cheats on September 9, 2013 at 6:36 pm
    • Reply

    You’ve made some really good points there. I looked on the internet for more information about the issue and found
    most individuals will go along with your
    views on this web site.

    • Malcolm on October 7, 2014 at 12:53 pm
    • Reply

    Greetings from Florida! I’m bored at work so I decided to browse your
    website on my iphone during lunch break. I love the knowledge you present here and can’t wait to take a look when I get home.
    I’m amazed at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyhow,
    very good blog!

    • Download Whatsapp for PC on October 17, 2014 at 6:19 am
    • Reply

    always i used to read smaller articles that as well clear their motive, and that is also happening with this article which I
    am reading here.

    • URL on May 27, 2014 at 6:47 am

    … [Trackback]

    […] Informations on that Topic: […]

Leave a Reply

Your email address will not be published.