Re: Re: Order question

From: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
To: Mitch Vincent <mitch(at)venux(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Order question
Date: 2001-02-13 23:23:54
Message-ID: 3A89C20A.E1226E86@wgcr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mitch Vincent wrote:
>
> A further extension of this..
>
> What might I be able to additionally order by so that the most recently
> updated rows get ordered above everything else (within the order by
> ordernum).. Using the same example :
>
> > ordernum | fieldname | oid
> > ----------+---------------+---------
> > 1 | J.jobtitle | 1197126
> > 1 | J.inv_id | 1197125
> > 2 | J.updatedon | 1197127
> > 3 | J.empinitials | 1197128
>
> I just set the row with j.inv_id to 1, I'd like it to be ordered above the
> row with j.jobtitle in it -- is that possible?

Add a column with a timestamp. Then, in the update/insert, make the
timestamp equal the current time. Then ORDER BY ordernum, timestamp.

Or better, modify the other ordernums, as you have an ambiguous
situation with two ordernums being equal. Writing that in a single
UPDATE would be left as an exercise for the reader :-).
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-02-13 23:23:55 Re: Re: Order question
Previous Message Mike Castle 2001-02-13 23:18:16 Re: Re: Order question