Re: Sort by foreign date column

From: "Andrey Y(dot) Mosienko" <feo(at)ttn(dot)ru>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Postgres <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sort by foreign date column
Date: 2001-08-21 05:56:59
Message-ID: 3B81F82B.B9C6347F@ttn.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo wrote:
>
> On Tue, 21 Aug 2001, Andrey Y. Mosienko wrote:
>
> >
> > I have table with date type column:
> >
> > chdate date;
> >
> > SELECT chdate from mytable;
> >
> > chdate
> > 1999-01-02
> >
> > But in Russia we have the next date format: DD-MM-YYYY.
> >
> > When I do coversion to char in SELECT:
> > TO_CHAR(chdate,'DD-MM-YYYY') everything is ok, but sort by this column
> > executes as sort for char type.
> >
> > How can I display my native date format and do right sorting by this column?
>
> Wouldn't
> select to_char(chdate, 'DD-MM-YYYY') from mytable order by chdate;
> work?

Works. But sorting performs as for CHAR TYPE!

--
with respection Andrey Feofilactovich.
e-mail: feo(at)ttn(dot)ru, feo(at)feo(dot)org(dot)ru
ICQ: 28073807

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2001-08-21 05:58:30 Re: spool
Previous Message Stephan Szabo 2001-08-21 05:36:33 Re: not grokking outer joins...