Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: 8i vs 9i: Difference in "group by" ?
In article <adgk2s$30c$2_at_reader1.panix.com>, "R says...
>
>Hi Tom, how about the DISTINCT function ?
>ie select distinct sale_date from sales;
>Can I avoid a sort here ?
>thanks
>Robert
The *only* way -- repeat -- the ONLY way to get an ordered result set is .... to use ORDER BY
period, end of statement -- nothing else to be said. If the optimizer uses a "distincting" step that happens to order the results -- it'll do the right thing (as little work as needed).
If you want the data ordered, you MUST use an order by.
>
>
>>group by NEVER had to sort -- I can give you examples all of the way back
>to 7.0
>>whereby the group by doesn't sort.
>>
>>It never had it.
>>It never was assured.
>>
>>The *only* way -- repeat -- the ONLY way to get an ordered result set is
>.... to
>>use ORDER BY
>
>
-- Thomas Kyte (tkyte@oracle.com) http://asktom.oracle.com/ Expert one on one Oracle, programming techniques and solutions for Oracle. http://www.amazon.com/exec/obidos/ASIN/1861004826/ Opinions are mine and do not necessarily reflect those of Oracle CorpReceived on Tue Jun 04 2002 - 09:20:49 CDT