Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: two tables, one result set, but no join!
Paul wrote:
> andrewst_at_onetel.com wrote:
>
>
> >> >Use UNION.
>
> >> Wouldn't UNION ALL be better in case there are duplicates?
>
> >What would be the point of having duplicates?
> >What would be the point of having duplicates?
>
>
> Getting all the data?
> Getting all the data?
>
>
> The OP presumably wants to process it in some way, and may need
> duplicates, since the data is coming from two separate tables.
>
> Why have UNION ALL at all?
> Why have UNION ALL at all?
UNION ALL is there for two reasons:
1) For the cases where for some reason you DO want the answer to
contain duplicates - but I can't imagine when that would be useful
2) For the cases where you KNOW there cannot be duplicates, and
therefore are able to speed up the operation by skipping the
de-duplication step - this can be useful
However, what you said was "Wouldn't UNION ALL be better in case there are duplicates?"
To which I suppose the answer is either "yes" if duplicates are wanted, or "no" if duplicates are possible but NOT wanted. Received on Wed Jun 01 2005 - 04:36:59 CDT
![]() |
![]() |