pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ralf Weidemann <Finc01@DX1.HRZ.Uni-Dortmund.DE>
To: PGSQL-GENERAL-ML <pgsql-general@postgresql.org>
Subject: sorting by date & time in descending order ??
Date: Tue, 30 Mar 1999 15:38:06 +0200 (CEST)
Message-ID: <14080.54206.589052.518312@onyx.nowhere.net> (raw)

Hi all,

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..

Thanks,
Ralf


wdb=> select surname, creationdate, creationtime 
       from message order by creationtime desc;
surname             |creationdate|creationtime
--------------------+------------+------------
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              |  29.03.1999|09:10:04    
Name_2              |  30.03.1999|09:10:04    
Name_3              |  22.03.1999|06:02:55    
(6 rows)

wdb=> select surname, creationdate, creationtime 
       from message order by creationdate desc;
surname             |creationdate|creationtime
--------------------+------------+------------
Name_2              |  30.03.1999|14:05:47    
Name_2              |  30.03.1999|10:10:04    
Name_1              |  30.03.1999|14:46:17    
Name_2              |  30.03.1999|09:10:04    
Name_2              |  29.03.1999|09:10:04    
Name_3              |  22.03.1999|06:02:55    
(6 rows)

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)


CREATE TABLE  Message
(
	MessageID			SMALLINT	NOT NULL,
    Title				CHAR(20)	NOT NULL,		
    Surname				CHAR(50)	NOT NULL,		
	EMail				CHAR(100),
	MessageURL			CHAR(100),
	Text				VARCHAR		NOT NULL,
	CreationDate		DATE		NOT NULL,
	CreationTime		TIME		NOT NULL,
    Expiry				SMALLINT	NOT NULL		
);




view thread (4+ messages)  latest in thread

Message-ID: <14080.54206.589052.518312@onyx.nowhere.net>
Permalink:  ../14080.54206.589052.518312@onyx.nowhere.net/
Also on:    postgresql.org/message-id/14080.54206.589052.518312@onyx.nowhere.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Finc01@DX1.HRZ.Uni-Dortmund.DE, pgsql-general@postgresql.org
  Subject: Re: sorting by date & time in descending order ??
  In-Reply-To: <14080.54206.589052.518312@onyx.nowhere.net>
  References: <14080.54206.589052.518312@onyx.nowhere.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox