从选择中删除

时间:2014-09-09 20:58:05

标签: mysql row sql-delete

我正在尝试将以下内容转换为删除过程,但似乎无效。

SELECT i08.pe01 AS fld1,
i08.pe02 AS fld11,
i08.pe03 AS fld21,
i08.nr01 AS nr0
FROM i08
LEFT JOIN i00 ON i08.pe01=i00.pno
WHERE  (i00.p9901 ='17' &&
i08.pe01 not in (SELECT distinct        i01_KIN.p01 AS fld81 FROM i01_KIN))

我正在尝试

DELETE FROM i08
USING i08, i00, i01_KIN
WHERE  (i00.p9901 ='17' &&
i08.pe01 not in (SELECT distinct     i01_KIN.p01 AS fld81 FROM i01_KIN))

但没有。任何可以提供帮助的人

1 个答案:

答案 0 :(得分:2)

如果我没有弄错你就不应该使用&&而是针对MySQL的AND

DELETE FROM i08
USING i08, i00, i01_KIN
WHERE  
(    i00.p9901 ='17' 
 AND i08.pe01 NOT IN (SELECT distinct i01_KIN.p01 AS fld81 FROM i01_KIN)
)