select B.*
from test.dbo.m2 B
where NOT EXISTs(select 1 from test.dbo.m1 A where A.姓名=B.姓名 and A.年龄 = B.年龄 and A.学历=B.学历)
select 编码, 通用名, 质量层次,count(*) from test.dbo.外表 A
group by 编码, 通用名, 质量层次
having count(*)>1
update a set a.[企业ID]=b.EnterpriseID from xzwsy a,Enterprise_info b where a.[企业名]
=b.EnterpriseName
匹配多行列平均赋值
update 表a set a3=(select avg(b3) from 表b where 表b.b1=表a.a1)
插入a表b表中不存在于A表的数据
insert into a
select xx from b where not exists (select xx from a where b.xx=a.xx)