View previous topic :: View next topic
|
Author |
Message |
op
New User
Joined: 31 Oct 2006 Posts: 48 Location: Chennai
|
|
|
|
Hi,
I do have some doubt in a DB2 update query.
I want to update the field FLD1 based on another field FLD2 in the same table.
eg. if FLD2 is '1', FLD1 should be updated with '3'
if FLD2 is '5', FLD1 should be updated with '1'
if FLD2 is '4', FLD1 should be updated with '6'
if FLD2 is '9', FLD1 should be updated with '0'
i.e there is a 1-1 mapping between FLD1 and FLD2 values.
Can I do the update with a single update query.
Thanks & Regards. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Easy enuf to test, but not as easy as asking someone else who may or may not know. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
op wrote: |
Hi,
I do have some doubt in a DB2 update query.
I want to update the field FLD1 based on another field FLD2 in the same table.
eg. if FLD2 is '1', FLD1 should be updated with '3'
if FLD2 is '5', FLD1 should be updated with '1'
if FLD2 is '4', FLD1 should be updated with '6'
if FLD2 is '9', FLD1 should be updated with '0'
i.e there is a 1-1 mapping between FLD1 and FLD2 values.
Can I do the update with a single update query.
Thanks & Regards. |
I don't think you can do it with a single update. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
case statement? |
|
Back to top |
|
|
|