Re: Re: Order question
От | Lamar Owen |
---|---|
Тема | Re: Re: Order question |
Дата | |
Msg-id | 3A89C20A.E1226E86@wgcr.org обсуждение исходный текст |
Ответ на | Order question ("Mitch Vincent" <mitch@venux.net>) |
Список | 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
В списке pgsql-general по дате отправления: