Re: Union
From: Tibor Karaszi (tibor_please.no.email_karaszi_at_hotmail.nomail.com)
Date: 09/14/04
- Next message: Joe Veler: "Cascade Delete within Self Referencing Table"
- Previous message: mgm: "Re: Automating a job"
- In reply to: Michael Culley: "Re: Union"
- Next in thread: Anith Sen: "Re: Union"
- Reply: Anith Sen: "Re: Union"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Sep 2004 20:30:51 +0200
There's no grouping involved. UNION removes the duplicates, quite simply. And UNION ALL does not.
However, this is not consistent with the SELECT LIST. If you don't specify ALL or DISTINCT, no
duplicate rows are removed.
To add to that, (the fact that UNION and SELECT work the opposite), you can't say UNION DISTINCT. (I
believe that you can in the latest ANSI SQL standard, though...)
Inconsistencies is what we pay for a naturally evolving language, I guess.
-- Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ "Michael Culley" <mculley@NOSPAMoptushome.com.au> wrote in message news:%236fATtfmEHA.3712@TK2MSFTNGP15.phx.gbl... > "GG" <anonymous@discussions.microsoft.com> wrote in message > news:18cd01c499f3$86a94780$a501280a@phx.gbl... >> YES... Use UNION ALL. UNION by itself performs an >> unnecessary grouping of your data. > > Thanks, that's what I thought. I guess they should have defined the UNION > keyword a little better all those years back, maybe UNION should just join > the results and UNION GROUP should do a union with grouping? > > -- > Michael Culley > >
- Next message: Joe Veler: "Cascade Delete within Self Referencing Table"
- Previous message: mgm: "Re: Automating a job"
- In reply to: Michael Culley: "Re: Union"
- Next in thread: Anith Sen: "Re: Union"
- Reply: Anith Sen: "Re: Union"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|