pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: juerg.rietmann@pup.ch
Cc: pgsql-sql@postgresql.org
Subject: Re: still sorting and casting problems
Date: Thu, 12 Sep 2002 06:54:29 -0700 (PDT)
Message-ID: <20020912065101.T45340-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <OF9F394F65.F3FC13C4-ONC1256C32.0036AAF4-C1256C32.00372D23@pup.ch>

On Thu, 12 Sep 2002 juerg.rietmann@pup.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.





view thread (3+ messages)  latest in thread

Message-ID: <20020912065101.T45340-100000@megazone23.bigpanda.com>
Permalink:  ../20020912065101.T45340-100000@megazone23.bigpanda.com/
Also on:    postgresql.org/message-id/20020912065101.T45340-100000@megazone23.bigpanda.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone23.bigpanda.com, juerg.rietmann@pup.ch
  Subject: Re: still sorting and casting problems
  In-Reply-To: <20020912065101.T45340-100000@megazone23.bigpanda.com>

* 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