Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: order by question
Hi Markus,
First of all the distinct is redundant, as group by occurs on distinct
values only.
Officially a group by is un-ordered. That it is ordered is because it has
been implemented with sort operations.
You shouldn't rely on group by providing ordered results.
You should think that adding order by 2 desc would resolve the issue.
Somehow I have a feeling it won't
In that case try
select * from
(your original query with the second column aliased as zahl) a
order by a.zahl desc
That should do the tric.
Hth,
Sybrand Bakker, Oracle DBA
<h0444vcs_at_rz.hu-berlin.de> wrote in message
news:7lqlf5$mpg$1_at_nnrp1.deja.com...
> Dear Readers,
>
> I have the following sql statement
>
> select distinct a.columname, count(a.columname)
> from ...
> where ...
> group by a.columname
>
> the result is then displayed and ordered by a.columname,
> but I want to display the result of the query ordered by
>
> count(a.columname) desc
>
> How does it work in oracle ?
>
> Many thanks in advance !
>
> Markus Banach
>
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
Received on Mon Jul 05 1999 - 11:29:16 CDT
![]() |
![]() |