Re: renumbering the data in a column?

From: gazzag <gareth_at_jamms.org>
Date: Thu, 15 Jan 2009 08:14:28 -0800 (PST)
Message-ID: <dc20bf76-9710-4159-9f18-fa86a27b152d_at_t26g2000prh.googlegroups.com>



On 14 Jan, 20:02, m..._at_pixar.com wrote:
> 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

I'm with Mark D Powell on this: why do you need to renumber that column anyway?

-g Received on Thu Jan 15 2009 - 10:14:28 CST

Original text of this message