sort up then down

From: "Randolph Jones" <jonesrf1(at)qwest(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: sort up then down
Date: 2003-04-13 01:50:07
Message-ID: 3E98C24F.1070507@qwest.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have database fields 1234567891.001;
I want to sort on first 10 digits descending; (last date first)
then ascending on the last 3 digit (page numbers)
the statement below gives the right answer,
but is this how to do it?

SELECT substr(imgname,1,10) AS name, substring(imgname,12,3) AS pg FROM
fax GROUP BY imgname, pg ORDER BY name DESC, pg ASC;

TIA
rfjones

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel Seichter 2003-04-13 19:50:11 SELECT Blobs into Delphi program
Previous Message Itai Zukerman 2003-04-12 04:01:49 Re: count(*), EXISTS, indexes