renumbering the data in a column?

From: <mh_at_pixar.com>
Date: Wed, 14 Jan 2009 20:02:08 GMT
Message-ID: <4xrbl.17724$Ws1.2395_at_nlpi064.nbdc.sbc.com>



I have some rows that I would like to renumber. For example:

    select * from t where name like 'x%' order by seq;

    seq name

  • ---- 15 xfoo 17 xbar 26 xbaz

desired state, seq column renumbered starting at 1:

    seq name

  • ---- 1 xfoo 2 xbar 3 xbaz

Is there a single sql statement that can do this? Or should I just loop over the result set and manually update the seq for each row?

Many TIA!
Mark

-- 
Mark Harrison
Pixar Animation Studios
Received on Wed Jan 14 2009 - 14:02:08 CST

Original text of this message