a solution for update
Posted by:
Erel Segal
Date: August 08, 2006 07:45AM
Based on solleon solution, here is a solution for updating a table column with the row num:
SET @rownum=0;
UPDATE [table] t, (SELECT @rownum:=@rownum+1 rownum, [table].* FROM [table]) r
SET t.[field] = r.rownum
WHERE (t.[primary_key] = r.[primary_key])
replace [table] with the name of your table, [field] with the name of the field that should contain the row number, and [primary_key] with the primary key of [table].
Subject
Views
Written By
Posted
17873
August 06, 2004 12:28AM
28377
September 26, 2004 09:04AM
11980
October 09, 2004 03:02PM
22627
October 10, 2004 12:56PM
12494
December 22, 2004 07:05AM
13498
December 22, 2004 01:59PM
9661
April 13, 2005 01:25PM
12977
April 14, 2005 12:08AM
7111
April 26, 2005 02:12AM
7621
April 20, 2005 04:37PM
9998
April 23, 2005 09:48AM
5664
August 26, 2008 03:47AM
5879
April 26, 2005 02:16AM
5606
October 18, 2005 02:57PM
5562
November 16, 2005 04:58PM
18717
June 28, 2006 04:39PM
a solution for update
19147
August 08, 2006 07:45AM
5341
December 14, 2008 10:01PM
5500
February 05, 2009 04:49PM
4697
December 27, 2008 03:27AM
4802
December 27, 2008 04:19AM
6526
February 08, 2007 02:20AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.