Union and Union All

  • sanjeewan99

    Say Hey Kid

    Points: 700

    Comments posted to this topic are about the item Union and Union All

  • Ron McCullough

    SSC Guru

    Points: 63877

    Nice to be reminded of the basics

    If everything seems to be going well, you have obviously overlooked something.


    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]


    SSC Guru

    Points: 281252

    bitbucket-25253 (7/7/2012)

    Nice to be reminded of the basics


    Jason...AKA CirqueDeSQLeil
    I have given a name to my pain...MCM SQL Server, MVP
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Ravi SQL


    Points: 1714

    nice one...


  • Revenant


    Points: 42467

    A really easy one for my Sunday evening... but it is always good to brush up on he basics.

    Thanks, Sanjeewan!

  • rhythmk


    Points: 7162

    Easy one to start the week.:-)

    To post your question use below link


  • Koen Verbeeck

    SSC Guru

    Points: 258965

    A little bit too easy. But then again, it's Monday...

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • SQLPhil

    SSCarpal Tunnel

    Points: 4204

    Koen Verbeeck (7/9/2012)

    A little bit too easy. ...

    I don't mind. After the shenanigans of last week it's nice to have a question that really does only have one possible answer! 😀

  • This was removed by the editor as SPAM

  • Michael Lysons


    Points: 6478

    Question. Answer. Sorted.

  • DugyC

    Hall of Fame

    Points: 3804

    Nice and simple back to basics, perfect for a Monday.

    Thanks 😀

    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • call.copse


    Points: 17239

    Though I was a little disappointed that it could not have been A, B, A as well, after indexgate, I did manage to get the idea fairly directly.

  • Vinay Kumar


    Points: 6098

    nice and easy.

    Vinay Kumar
    Keep Learning - Keep Growing !!!

  • Duncan Pryde


    Points: 7956

    Not a bad question, and got me thinking about other possible questions, so here goes - how many rows are returned in the two following cases?

    -- Query 1

    SELECT 'A'


    SELECT 'A'


    SELECT 'A'

    -- Query 2

    SELECT 'A'


    SELECT 'A'


    SELECT 'A'

    Try to guess first, then use MS to verify. 😀

  • Andre Guerreiro


    Points: 7319

    For one moment, I thought there was a catch somewhere as the question and code all looked very easy.

    It's interesting how the first part of the UNION is a derived table without an outer SELECT. I thought that would raise an error. But it seems the query processor changes the order of the UNION? (EDIT: No, it doesn't.)

    Excellent question to start the week. Thank you.

    EDIT: Nevermind. I was confused with the parenthesis. SQL Server will allow that just fine. Need more coffee.

    Best regards,

    Andre Guerreiro Neto

    Database Analyst

Viewing 15 posts - 1 through 15 (of 38 total)

You must be logged in to reply to this topic. Login to reply