Re: [GENERAL] Problem with getting the right order

From: Ulf Mehlig <umehlig(at)uni-bremen(dot)de>
To: HenrikP(at)mail(dot)ikasths(dot)dk
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Problem with getting the right order
Date: 1998-10-22 08:50:23
Message-ID: 199810220850.KAA02168@uni-bremen.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Generally, something like

select count(vnr), enr
from votes
group by err
order by 1 desc

should work. But I tried it only with my own tables ... For
referencing to the first column of the resulting table ("order by 1")
you can also use

select count(vnr) as the_count, [...]
order by the_count desc

If you want to get reversed ordering (you said you'd like to get the
bigger numbers first), you have to specify "desc", default is "asc",
which will do it the other way round.

Hope it helps!
Ulf

--
======================================================================
%%%%% Ulf Mehlig <ulf(dot)mehlig(at)uni-bremen(dot)de>
%%%%!%%% Projekt "MADAM" <umehlig(at)uni-bremen(dot)de>
%%%% %!% %%%% ----------------------------------------------------
---| %%% MADAM: MAngrove | Center for Tropical Marine
||--%!% Dynamics | Biology
|| And | Fahrenheitstrasse 1
_ /||\_/\_ Management |
/ / \ \ ~~~~~~~~~~~~~~~~~ | 28359 Bremen/Germany
~~~~~~~~~~~~~~~~~~~~

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ulf Mehlig 1998-10-22 09:28:01 Re: [GENERAL] aggregate question
Previous Message Peter T Mount 1998-10-22 05:54:11 Re: [GENERAL] CORBA and PostgreSQL