Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.2/8.9.1) with ESMTP id IAA39609 for ; Tue, 30 Mar 1999 08:58:23 -0500 (EST) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id C2DCD4B4E4; Tue, 30 Mar 1999 13:58:20 +0000 (Asia/Jerusalem) Received: from [147.233.148.140] (1164.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA2BDF; Tue, 30 Mar 1999 16:00:06 +0200 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <14080.54206.589052.518312@onyx.nowhere.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Tue, 30 Mar 1999 16:00:01 +0200 To: Ralf Weidemann , pgsql-sql@postgreSQL.org From: Herouth Maoz Subject: Re: [GENERAL] sorting by date & time in descending order ?? (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