Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Select Distinct (was top N or rewriting MAX)
Pardon my jumping in again,
I answered the original post (top N rows in a table) by saying
The above delivers the N lowest distinct values of col (If col is numeric you can easily get the top values by selecting distinct (Y - col) where Y is any value larger than max(col).
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?
Alan Wilson Help fight continental drift.Received on Thu Jan 16 1997 - 00:00:00 CST
======================================================================