日期:2014-05-17  浏览次数:20857 次

sql语句咋写?
SQL code
insert into table select * from test;


test表中有一个字段我是通过程序生成的,其他字段都是原值。非得一个个字段写吗?

insert into tabel select '外部生成',col1,col2,col3,..... from test;

求解!谢谢!

------解决方案--------------------
如果你tabel1的字段和你test表的字段完全相同(包括列数和类型),那么就可以用
insert into tabel1 select * from test;
来插入了,否则,你最好还是把字段都列出来吧,
insert into tabel1(column1,column2...)
select a,b...
from test;
------解决方案--------------------
create table tables1 as select * from test;
alter table tables1 drop column '外部生成';
^_^
------解决方案--------------------
探讨
引用:
create table tables1 as select * from test;
alter table tables1 drop column '外部生成';
^_^

美女,这招杀伤力太大了。

------解决方案--------------------
哈哈,那个方便用哪个!
------解决方案--------------------
给表test建个不包含那列的视图,然后用这个视图写sql
------解决方案--------------------
探讨
create table tables1 as select * from test;
alter table tables1 drop column '外部生成';
^_^