求一个sql语句!! delete b from 表1 ajoin 表2 b on a.code = b.code where (select sum(数量) from 表2 where code = b.code) = 0 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 delete 表2 where codein(select code from 表2 group by codehaving sum(数量)=0) 忘记看条件表1的code=表1的code了。delete 表2 where codein(select code from 表2 group by codehaving sum(数量)=0) and code in (select code from 表1) 好象与表1无关啊。delete 表2 where codein (select code from 表2 group by codehaving sum(数量)=0) delete 表2 from 表2 a join(select code from 表2 group by code having sum(数量)=0) b on a.code=b.code 求SQL 重分求教一个mssql疑难问题,请高手进来看看: 请帮忙推荐一本SQL 2005的好书 求教一个SQL语句! 数据库表中有许多重复的记录,怎样批量删除其中的一条只剩下唯一的记录 安装数据库出现的问题.. 类型转换 不包含18的 行 的条件() 请问有人用过 用户权限矩阵 这个算法吗? 如何把纵表中数据横向连接? sqlservr.exe占用内存越来越大的问题?? 散分100!《关于使用image数据类型的问题》
in
(
select code from 表2
group by code
having sum(数量)=0
)
delete 表2 where code
in
(
select code from 表2
group by code
having sum(数量)=0
)
and code in (select code from 表1)
in (select code from 表2
group by code
having sum(数量)=0
)
delete 表2 from 表2 a join(
select code from 表2 group by code having sum(数量)=0
) b on a.code=b.code