Sql Update stmt help [message #249385] |
Wed, 04 July 2007 04:19 |
Nusrat
Messages: 38 Registered: June 2007 Location: Mumbai(India)
|
Member |
|
|
Hi
I have a following data in table test
col1
0
0
0
1
1
1
2
2
2
3
3
3
i want to update the data and it should look like this
3
3
3
2
2
2
1
1
1
0
0
0
thanks in advance
nusrat
|
|
|
|
|
|
|
|
Re: Sql Update stmt help [message #249438 is a reply to message #249385] |
Wed, 04 July 2007 08:38 |
iamdurai
Messages: 96 Registered: April 2007 Location: Chennai
|
Member |
|
|
Hi Michel,
your exactly correct just i gave the tips.why i gave like that means, he/she want to know about decode function thats why.
This is ans:
" update tab_name
set col1=decode(col1,'0',1,'1',2,'2',3,'3',0); "
Reds
Thangam.
[Updated on: Wed, 04 July 2007 08:40] Report message to a moderator
|
|
|
|
|
Re: Sql Update stmt help [message #249446 is a reply to message #249438] |
Wed, 04 July 2007 09:21 |
Nusrat
Messages: 38 Registered: June 2007 Location: Mumbai(India)
|
Member |
|
|
hi
this is also working ,but there is a problem in it.
if i m having 1..100 then it will be little bit painful
" update tab_name
set col1=decode(col1,'0',1,'1',2,'2',3,'3',0); "
Thanks
Nusrat
|
|
|
|
Re: Sql Update stmt help [message #249550 is a reply to message #249458] |
Thu, 05 July 2007 00:31 |
Nusrat
Messages: 38 Registered: June 2007 Location: Mumbai(India)
|
Member |
|
|
Hi
Thanks for your help.
There was a requirement to update the 'From Date' and 'To Date' to match the data with privious year.
Thanks
Nusrat
|
|
|
|
|
Re: Sql Update stmt help [message #249567 is a reply to message #249565] |
Thu, 05 July 2007 01:14 |
|
Michel Cadot
Messages: 68718 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Most often dates are different than numbers so maybe the solution could be different.
But if it is OK for you, it is OK for me.
Regards
Michel
|
|
|