Re: [GENERAL] sorting by date & time in descending order ??

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: Ralf Weidemann <RalfW(at)Scalar(dot)DE>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [GENERAL] sorting by date & time in descending order ??
Date: 1999-03-30 14:00:01
Message-ID: l0311070cb32688a1b488@[147.233.148.140]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

(The topic of this question fits better in the SQL list than the GENERAL list).

At 15:38 +0200 on 30/03/1999, Ralf Weidemann wrote:

> I want to sort my output by date & time in descending
> order. How can I do this ? Date or time alone is not
> enough and the combination of both does not work. At
> least in the way I tried it..
[snip]
>
> wdb=> select surname, creationdate, creationtime
> from message order by creationdate, creationtime desc;
> surname |creationdate|creationtime
> --------------------+------------+------------
> Name_3 | 22.03.1999|06:02:55
> Name_2 | 29.03.1999|09:10:04
> Name_1 | 30.03.1999|14:46:17
> Name_2 | 30.03.1999|14:05:47
> Name_2 | 30.03.1999|10:10:04
> Name_2 | 30.03.1999|09:10:04
> (6 rows)

You have to indicate whether you want ascending or descending sort on each
of the sort columns. When you don't, the default is ascending. Thus, the
above statement is equivalent to:

... order by creationdate asc, creationtime desc;

So, you need to use

... order by creationdate desc, cretaiontime desc;

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma

In response to

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 1999-03-30 14:09:05 Re: [GENERAL] Performance
Previous Message Ralf Weidemann 1999-03-30 13:38:06 sorting by date & time in descending order ??

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Bitmead 1999-03-30 14:45:28 How to do this in SQL?
Previous Message Ralf Weidemann 1999-03-30 13:38:06 sorting by date & time in descending order ??