An update statement required [message #302861] |
Wed, 27 February 2008 03:38 |
srinivas.k2005
Messages: 404 Registered: August 2006
|
Senior Member |
|
|
Hi All,
I want an update statement to update the records below
I have a table test:
new_id id PARENT_ID
1 100
2 102 100
3 103 100
4 104 102
5 105 102
i need an update statement so that new_id will get updated to parent_id as shown below.
AFTER UPDATE I WANT THE OUTPUT AS BELOW:
new_id id PARENT_ID
1 100
2 102 1
3 103 1
4 104 2
5 105 2
Thanks,
Srinivas
[Mod-edit: corrected code-tags.]
[Updated on: Wed, 27 February 2008 03:45] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: An update statement required [message #302874 is a reply to message #302861] |
Wed, 27 February 2008 04:02 |
srinivas.k2005
Messages: 404 Registered: August 2006
|
Senior Member |
|
|
NOW...............
UPDATE TEST_ID SET PARENT_ID = (SELECT NEW_ID FROM TEST_ID S WHERE S.ID = TEST_ID.PARENT_ID);
some times it fails to update query ,and it has been very difficult to find where it failed in lakh records.
|
|
|
|
Re: An update statement required [message #302884 is a reply to message #302861] |
Wed, 27 February 2008 04:27 |
mshrkshl
Messages: 247 Registered: September 2006 Location: New Delhi
|
Senior Member |
|
|
According to you:
Quote: | it has been very difficult to find where it failed in lakh records
|
but also,
Quote: | some times it fails to update query
|
May I have the row in which you think so ?
regards,
|
|
|