X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C0C08D1D1D5 for ; Sat, 24 Apr 2004 08:16:31 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 11284-08 for ; Sat, 24 Apr 2004 08:16:16 -0300 (ADT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id 1EAE1D1D17E for ; Sat, 24 Apr 2004 08:16:13 -0300 (ADT) Received: (qmail 17612 invoked from network); 24 Apr 2004 11:16:15 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 24 Apr 2004 11:16:15 -0000 From: "Greg Sabino Mullane" To: pgsql-sql@postgresql.org Subject: Re: Order by YYYY MM DD in reverse chrono order trouble X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <20040421103003.79774.qmail@web12703.mail.yahoo.com> Date: Sat, 24 Apr 2004 11:16:15 -0000 X-Mailer: JoyMail 1.47 Message-ID: <9ae4fad2ef01b3eebb7769a43b955c0b@biglumber.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200404/265 X-Sequence-Number: 17640 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > I am trying to select distinct dates and order them in the reverse > chronological order. Although the column type is TIMESTAMP, in this > case I want only YYYY, MM, and DD back. If you don't need them separated (which I suspect may be the case), you can do something like this: SELECT DISTINCT TO_CHAR(add_date,'YYYY-MM-DD') AS bb FROM tt ORDER BY bb DESC; - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200404240716 -----BEGIN PGP SIGNATURE----- iD8DBQFAikzOvJuQZxSWSsgRAgqbAKDC75SQd2aExYaniSJIzovOlVjvCACgyOAl Q2KMp3YGBkQwy5y4h9r/96A= =4idZ -----END PGP SIGNATURE-----