Re: Sorting on fieldtype Time?

From: Bjørn T Johansen <btj(at)havleik(dot)no>
To: Bruno Wolff III <bruno(at)wolff(dot)to>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sorting on fieldtype Time?
Date: 2003-07-09 14:01:38
Message-ID: 1057759297.16775.24.camel@pennywise.havleik.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You are absolutely correct, I could... :)

Thanks....

BTJ

On Wed, 2003-07-09 at 15:48, Bruno Wolff III wrote:
> On Wed, Jul 09, 2003 at 11:24:14 +0200,
> Bjorn T Johansen <btj(at)havleik(dot)no> wrote:
> > I have a small problem.. I need to sort some rows on a Time field, but
> > the time in these rows are recorded on evenings and nights, from 2200 to
> > 0600 for instance. The problem is that the time after midnight should
> > come after the time before midnight, i.e. 2315, 2345, 0015, 0100 should
> > be sorted in this order and not 0015, 0100, 2315,2345.
> > Is there a solution to this, other than using Timestamp instead of Time?
>
> You could do something like like:
>
> select timecol from timetab order by timecol <= 1200, timecol;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2003-07-09 14:32:58 Re: making multiple updates use indexes: howto?
Previous Message Lamar Owen 2003-07-09 14:00:32 Re: Is Postgres broken in Red Hat 9?