舉例1:
insert into table_b(time,score,totalscore) select time,score,sum(score) over (order by time) from table_a
舉例2:
insert into JobInfo_analysis(Salary,address,jobname,company,companysize,companytype,Educational,remak,Releasetime,created,id,LinkStatus,Reply,MyNote,LoveLevel) select Salary,address,jobname,company,companysize,companytype,Educational,remak,Releasetime,created,id,LinkStatus,Reply,MyNote,LoveLevel from JobInfo where address like'%北京%' and (jobname like'%ios%' or jobname like'%iphone%' or remak like '%ios%' or remak like 'iphone') and cast(substr(Salary,7,12) as int) >= 20001 and cast(substr(Salary,7,12) as int) <= 35000 and company not like '%咨詢%' and company not like '%顧問%' and company not like '%獵頭%' and company not like '%管理%' and company not like '%獵聘%' and company not like '%某公司%' and company not like '%人力資源%' and company not like '%人才服務%'
總結:
SQL數據庫中把一個表中的數據復制到另一個表中
1、如果是整個表復制表達如下:
insert into table1 select * from table2
2、如果是有選擇性的復制數據表達如下:
insert into table1(column1,column2,column3...) select column1,column2,colunm3... from table2
3、一個數據庫中的表中的數據復制到另一個數據庫中的一個表,使用方法如下:
insert into 數據庫A.dbo.table1(col1,col2,col3...) select col1,col2,col3... from 數據庫B.dbo.table2