|
楼主 |
发表于 2020-7-22 15:45:01
|
显示全部楼层
if object_id('a') is not null drop table a
go
CREATE TABLE a (
[teacherid] [varchar] (50),
[courseinfo] [varchar] (50),
[coursename] [varchar] (50),
[point] [float] ,
)
insert into a(teacherid,courseinfo,coursename,point) values('0001','0101011002_1_1','岩浆岩及变质岩石学_理论',80.05)
insert into a(teacherid,courseinfo,coursename,point) values('0002','0101011003_1_1','岩浆学_理论',90.50)
insert into a(teacherid,courseinfo,coursename,point) values('0003','0101011006_1_1','变质岩石学_理论',90.50)
insert into a(teacherid,courseinfo,coursename,point) values('0004','0101011007_1_1','地理信息学_理论',90.50)
go
if object_id('b') is not null drop table b
go
CREATE TABLE b (
[teacherid] [varchar] (50),
[courseinfo] [varchar] (50),
[coursename] [varchar] (50),
[point] [float] ,
)
insert into b(teacherid,courseinfo,coursename,point) values('0001','0101011002_1_1','岩浆岩及变质岩石学_理论',83.05)
insert into b(teacherid,courseinfo,coursename,point) values('0003','0101011006_1_1','变质岩石学_理论',95.50)
insert into b(teacherid,courseinfo,coursename,point) values('0005','0101011008_1_1','地理信息学_理论',90.50)
go
select * from a
select * from b
----上面这段生成表
---这个答案有眉目,但是还没有完全回答我的问题
insert into a
select teacherid,courseinfo,coursename,0
from b
where teacherid not in(select distinct teacherid from a |
|