日期:2014-05-17  浏览次数:20710 次

delete和exists一起用的问题,求达人!
SQL code
select * from zjolsms_ig..tb_smsdeliver c where exists
(select p_number from zjolsms_ig..tb_programinfo a,zjolsms_ig..tb_userinfo b 
where a.c_id=b.u_relationid and b.u_loginname='czgd105' and b.u_level=2 and a.p_number=c.p_number)

delete from zjolsms_ig..tb_smsdeliver c where exists 
(select p_number  from zjolsms_ig..tb_programinfo a,zjolsms_ig..tb_userinfo b 
where a.p_number=c.p_number and a.c_id=b.u_relationid and b.u_loginname='bbgd104' and b.u_level=2) 


如上,我查询语句可以执行,但是删除语句执行不了,WHY?
报错内容:
消息 102,级别 15,状态 1,第 1 行
'c' 附近有语法错误。

即delete那行的c附近有错误,我咋看也没看出错误啊?!求达人!

------解决方案--------------------
探讨

引用:
delete c from zjolsms_ig..tb_smsdeliver c where exists
(select p_number from zjolsms_ig..tb_programinfo a,zjolsms_ig..tb_userinfo b
where a.p_number=c.p_number and a.c_id=b.u_r……