SQL复制表中的数据
我想复制表中的一些数据,只更改一列。如下所示:SQL复制表中的数据,sql,Sql,我想复制表中的一些数据,只更改一列。如下所示: Before: C1 C2 C3 .... // C1 C2 C3 are columns, C3 have same value a1 b1 c a2 b2 c a3 b3 c After: C1 C2 C3 .... // for the copy, all columns are same except C3, all c and f are same value a1 b1 c a2 b2 c a3 b3 c ... a
Before:
C1 C2 C3 .... // C1 C2 C3 are columns, C3 have same value
a1 b1 c
a2 b2 c
a3 b3 c
After:
C1 C2 C3 .... // for the copy, all columns are same except C3, all c and f are same value
a1 b1 c
a2 b2 c
a3 b3 c
...
a1 b1 f
a2 b2 f
a3 b3 f
在sql中有什么快速的方法可以做到这一点吗?谢谢
insert into your_table (C1, C2, C3)
select C1, C2, 'f'
from your_table