Reputation: 11
I have a table WC_C
with column C_S(varchar(2))
. I need to add a new column in this same table R_S(varchar(2))
and move the contents of C_S
which has values A, C, D
to column R_S
.
How do I do it?
Requirement:
WC_C
C_S
contains values A, B, C, D, E, F
R_S
Should contain A, C, D
from C_S
column.Upvotes: 1
Views: 86
Reputation: 102458
Using MySQL syntax since you tagged your question with it...
Add new column R_S
:
alter table WC_C add R_S VARCHAR(2);
Insert data into new column:
insert into WC_C (R_S) select C_S from WC_C where C_S IN ('A', 'C', 'D');
Note: I haven't tested the above queries. Use with discretion.
Upvotes: 2