Re: still sorting and casting problems

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <juerg(dot)rietmann(at)pup(dot)ch>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: still sorting and casting problems
Date: 2002-09-12 13:54:29
Message-ID: 20020912065101.T45340-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 12 Sep 2002 juerg(dot)rietmann(at)pup(dot)ch wrote:

>
> Hello there
>
> Unfortunately, I can't change the fieldtype that easy because other
> applications use the date as char(10) field as well.
>
> I need to sort the query by the log_date desc (log_date is char(10)). I
> tried the following without success :
>
> select id, log_date from userlog order by cast (log_date as date) desc
>
> select id, log_date from userlog order by date(log_date) desc
What do you get when trying this last query (something of the sort
works for me in 7.3beta). It's possibly that you might need to use
date(log_date::text) desc, but without the error it's hard to say.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2002-09-12 13:57:51 Re: still sorting and casting problems
Previous Message Gaetano Mendola 2002-09-12 13:15:57 Re: Select the max on a field