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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: group by sorting

Re: group by sorting

From: Jonathan Gennick <jonathan_at_gennick.com>
Date: Wed, 18 Oct 2000 09:58:14 -0400
Message-Id: <10653.119653@fatcity.com>


Hello Chris,

Tuesday, October 17, 2000, 6:22:41 PM, you wrote:

BC> I have looked in a couple manuals for this but have not
BC> found it.  When doing a group by, a sort is done on the
BC> data. Is there anyway to specify a descending order for
BC> that sort?  It is defaulted to ascending.  Is there a
BC> way of overriding that?

If you want the data sorted in any particular order at all, you should specify that explicitly using the ORDER BY clause. It's not safe to depend on side-effects. A GROUP BY may seem to trigger an ascending sort, but I wouldn't put too much faith in that. Grouped data only needs to be sorted enough to accomplish the grouping. It wouldn't surprise me if you could put together a scenario in which a GROUP BY query returned properly grouped data that was not sorted in any particular order. Use ORDER BY if order is important to you. Received on Wed Oct 18 2000 - 08:58:14 CDT

Original text of this message

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