Re: forcing date ordering

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "tab view" <tabview(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: forcing date ordering
Date: 2004-09-11 06:22:47
Message-ID: 7649.1094883767@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"tab view" <tabview(at)hotmail(dot)com> writes:
> When I do the following piece of SQL
> SELECT DISTINCT to_char(datetimelogged,'dd/mm/yyyy') AS datelogged FROM
> logins ORDER BY datelogged DESC;

> I don't seem to get the column sorted in date order.

I'd expect that to produce a textual sorting of the to_char strings.

> How do I force psql to use date order?

Sort by the underlying datetimelogged column, which I suppose is of
date or timestamp type ...

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Doug McNaught 2004-09-11 13:55:42 Re: PL/pgSQL Function Problem
Previous Message Michalis Kabrianis 2004-09-11 06:22:36 Re: [SQL] PL/pgSQL Function Problem