高手进

表A:
AID,NAME
表B:
BID,NAME,AID

我想同时删除A表里面满足条件的数据,以及B表中A表相关的数据,我的SQL语句如下:
delete from A,B where A.AID =1 AND A.AID = B.AID
运行时候,报错:SQL命令未正确结束
请问这个写法有什么错误,能够同时删除多个表的数据吗?

作者: apdaoshi   发布时间: 2011-06-09

SQL code

delete A  from A,B where A.AID =1 AND A.AID = B.AID


作者: sekai2011   发布时间: 2011-06-09

SQL code
--最好分成两条语句

delete from A where A.AID =1 
delete from B where B.AID =1 

作者: cd731107   发布时间: 2011-06-09

SQL code

begin transaction

delete from A where A.AID =1 
delete from B where B.AID =1 

commit transaction

作者: abcjun188   发布时间: 2011-06-09