Iterating result of Select Query
Posted
by user294146
on Stack Overflow
See other posts from Stack Overflow
or by user294146
Published on 2010-04-12T15:14:24Z
Indexed on
2010/04/12
15:23 UTC
Read the original article
Hit count: 398
Hi experts,
I have a question related to select query. here i am explaining down below.
i have a table with the following data
**Column1(Primary Key) Column2 Column3**
------ --------- --------------
1 C
2 C
3 Null
4 H
5 L
6 H
my problem is i have to replace the value of Column3 with the corresponding value of Column1 for every occurrence of data "C", "H" and "L". Please provide me query related to this problem. how can i solve this using query or stored procedure. please elaborate the same.
I need final select query result as follows
**Column1(Primary Key) Column2 Column3**
------ --------- --------------
1 C 1
2 C 2
3 Null
4 H 4
5 L 5
6 H 6
Thanks & Regards, Murali
© Stack Overflow or respective owner