如何依条件delete多行啊?
delete stock where codenum=(select codenum from listbody where headid=25)
这样写是错误的,执行显示“子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。语句已终止。”
但是 codenum是字符串型,不是数值,所以不能用codenum in,求解决方案
[解决办法]
delete stock where codenum in(select codenum from listbody where headid=25)
存在多个值不能用等号,用in
[解决办法]
delete stock where codenum in (select codenum from listbody where headid=25)
或者
delete stock
from listbody
where stock.codenum=listbody.codenum and listbody.headid=25