Re: [GENERAL] Problem with getting the right order - Mailing list pgsql-general

From Ulf Mehlig
Subject Re: [GENERAL] Problem with getting the right order
Date
Msg-id 199810220850.KAA02168@uni-bremen.de
Whole thread Raw
In response to Problem with getting the right order  (Henrik Pedersen <HenrikP@mail.ikasths.dk>)
List 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.mehlig@uni-bremen.de>
   %%%%!%%%       Projekt "MADAM"         <umehlig@uni-bremen.de>
%%%% %!% %%%%     ----------------------------------------------------
 ---| %%%         MADAM:  MAngrove    |  Center for Tropical Marine
    ||--%!%              Dynamics     |  Biology
    ||                  And           |  Fahrenheitstrasse 1
 _ /||\_/\_            Management     |
/  /    \  \ ~~~~~~~~~~~~~~~~~        |  28359 Bremen/Germany
  ~~~~~~~~~~~~~~~~~~~~

pgsql-general by date:

Previous
From: Peter T Mount
Date:
Subject: Re: [GENERAL] CORBA and PostgreSQL
Next
From: Ulf Mehlig
Date:
Subject: Re: [GENERAL] aggregate question