Union Forcing Distinct

  • Comments posted to this topic are about the item Union Forcing Distinct

  • Not an issue for me...this has always been the behaviour of UNION.

    I've often used

    select c,b FROM #a

    UNION

    select c,b FROM #a

    to eliminate / identify duplicates.

    As for multiple UNIONs / UNION ALLs it just applies them sequentially.

  • varchar(1)?

    There is an exception to every rule, except this one...

  • Interesting - I wouldn't have suspected that UNION makes the result set from each separate select "distinct".

    I would guess that a "UNION" is really a "UNION ALL", with a subsequent "SELECT DISTINCT" to return the rows to the user.

  • Thanks for the script.

Viewing 5 posts - 1 through 4 (of 4 total)

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