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: group by and sorting

Re: group by and sorting

From: <fitzjarrell_at_cox.net>
Date: 31 May 2005 14:26:08 -0700
Message-ID: <1117574768.331856.68240@g47g2000cwa.googlegroups.com>

Eugene wrote:
> Hi all,
> Is there a way to "tell" Oracle not to sort when it's doing GROUP BY? I
> think I saw something like ... group by nosort somewhere.
>
> Eugene

Oracle doesn't 'sort' by default with group by, and such is noted in the documentation:

"The GROUP BY clause groups rows but does not guarantee the order of the result set. To order the groupings, use the ORDER BY clause."

If the operation doesn't sort there is no need for a 'nosort' option, which is invalid syntax:

SQL> select deptno, count(*) from emp group by deptno nosort; select deptno, count(*) from emp group by deptno nosort

                                                 *
ERROR at line 1:
ORA-00933: SQL command not properly ended

SQL> I cannot imagine where you might have 'seen' such syntax; certainly not with respect to Oracle. And, according to your post, neither do you.

David Fitzjarrell Received on Tue May 31 2005 - 16:26:08 CDT

Original text of this message

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