Subject Re: [firebird-support] Re: UNION prevents all records from being pulled to the results
Author Ann Harrison
On Mon, Oct 29, 2012 at 5:06 PM, Aage Johansen <aagjohan@...> wrote:

> SoftTech wrote:
> <<
> The SQL that follows pulls these results: (These results are missing 5
> records from the second select of the union)
> FEE_CODE AMT_EARNED_AGENCY SHOW_IN_PMT_DIST_PLAN FEE_CATEGORY
> CCO2 76 1 0
> SVC 1.17 1 0
> SVC 30 1 0
>
> ... ...
> >>
>
>
> From Helen's Firebird book:
> If duplicate rows are formed during the creating of the union set,
> the default behavior is to exclude the duplicate rows from the set.
> To include the duplicates, use UNION ALL instead of UNION on its own .
>


And if anybody is curious, yes, that is the behavior described in the
ANSI/ISO SQL Standard. One of the few holdovers from set theory in SQL.

Good luck,

Ann


[Non-text portions of this message have been removed]