Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Select Distinct (was top N or rewriting MAX)

Re: Select Distinct (was top N or rewriting MAX)

From: Roger Wernersson <roger.wernersson_at_adra.se>
Date: 1997/01/17
Message-ID: <32DF9F9E.11B7@adra.se>#1/1

AWILSON wrote:
> In this instance, select distinct seems to do an implicit 'order by' on
> the distinct values of 'col'. It is a bit of a kluge, but seems to work
> OK.
>
> This raises a couple of interesting points.
>
> How does Select Distinct work - ie what mechanism does it use to ensure
> distinctness?
> Can it be relied upon to work the same way in future?

Hello!

I have also noticed that the following statement orders the rows:

SELECT value FROM one_table
UNION
SELECT value FROM other_table;

This, on the other hand, does not:

SELECT value FROM one_table
UNION ALL
SELECT value FROM other_table;

I think they work the same way, that is, it is more efficient to work with
ordered matrerial if you are to remove duplicates as you must look for similar values so why scramle them when you're done?

> Alan Wilson Help fight continental drift.

LOL  :->                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

-- 
Sport radio: people listening to people watching people having fun
Mailto:roger.wernersson_at_adra.se
BTW: All opinions are mine, all mine, and nobody's but mine.
Received on Fri Jan 17 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US