sql 补集

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值