利用sql语句复制一条或多条记录
sql 复制记录
insert into article (id,class,title,content) select id,'2',title,content from article where class='1'
如果id为自动编号,就把改为:
insert into article (class,title,content) select '2',title,content from article where class='1'
如果class为数字类型,则去掉单引号.
insert into ctt (pid,nme,url,tar,src,tip,dte,odr,p01,p02,flg,con,cnt,kwd,t,d,k,u,prp,i,s) select 50,nme,url,tar,src,tip,dte,odr,p01,p02,flg,con,cnt,kwd,t,d,k,u,prp,i,s from ctt where pid between 42 and 49;
134 176
177219
220 262
pid,nme,con,odr,url
insert into cts (pid,nme,con,odr,url) select 50,nme,con,odr,url from cts where pid=49;
177219
220 262
pid,nme,con,odr,url
insert into cts (pid,nme,con,odr,url) select 50,nme,con,odr,url from cts where pid=49;