DB2如何从两个表中删除

时间:2015-02-03 07:12:22

标签: sql db2

我正在尝试从两个表中删除记录,有人可以帮我纠正我的查询。感谢。

这就是我的尝试:

DELETE FROM 
           table1 x, 
           table2 xx
       WHERE x.id ='123' AND xx.id = '123'

2 个答案:

答案 0 :(得分:0)

delete from table1 x where x.id ='123'

delete from table2 xx where xx.id = '123'

答案 1 :(得分:0)

您无法删除包含两个表的变量。你应该逐个删除。

DELETE FROM table1 where id = '123';
DELETE FROM table2 where id = '123';