SQL - 使用内部联接删除对象

时间:2015-02-18 15:42:53

标签: sql oracle11g

我正在尝试使用SQL和内部联接

从我的商店中删除对象

这就是我所拥有的:

DELETE appointment_object
FROM appointment_table appointment_object
INNER JOIN sales_person_table sales_person_object
ON appointment_object.made_by.personno = sales_person_object.personno
WHERE sales_person_object.personno = 3;

这是我的错误:

Error report -
SQL Error: ORA-00903: invalid table name
00903. 00000 -  "invalid table name"
*Cause:    
*Action:

但是,所有属性名称和表名都是正确的。

我还在appointment_object FROM之间获得了一些语法突出显示错误:

Expected WHERE, PARTITION

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

尝试使用existsin

重新措辞
DELETE
    FROM appointment_table
    WHERE EXISTS (SELECT 1
                  FROM sales_person_table sp
                  WHERE a.made_by.personno = sp.personno AND
                        sp.personno = 3
                 );