Subject | RE: [firebird-support] Union statement automatically adds 'DISTINCT'? |
---|---|
Author | Alan McDonald |
Post date | 2007-04-30T21:42:41Z |
> I have two statements:use UNION ALL
>
> Select [fields] from [Table1]
> Select [fields] from [Table2]
>
> The [Fields] are the same. Running them individually I get 39 records,
> and 1 record. Running them together with a UNION between them I get 33
> records. After some checking, it appears that what it thinks are
> duplicates are being removed. I never specified the DISTINCT option for
> the select statement though. Can anyone confirm that this is what
> Firebord does?
>
> I added a temporary selection field of
> 'cast('a' || PK_Field as varchar(10))'
> and 'cast('b' || PK_Field as varchar(10))'
> where PK_Field is the primary key field for each table, and it seems to
> have stopped eliminating the duplicates.
>
> I just wanted to make sure that I'm correct in my assumption of the
> union clause. I'm using FB 1.5.3.
>
> Thanks,
> Paul Gardner
Alan