将postgres的查询“删除连接”转换为oracle

时间:2017-07-06 12:04:52

标签: sql oracle postgresql using

大家好,感谢您的关注。我必须从postgres“traslate”到oracle这个“删除连接查询”

DELETE FROM AAA USING BBB WHERE (AAA.date = BBB.date)
 AND (AAA.idtipo = BBB.idtipo)
 AND (AAA.tariffario = BBB.tariffario)
 AND (BBB.IDOrigine = 20 )

谢谢!! 吉安

1 个答案:

答案 0 :(得分:1)

使用exists

DELETE FROM AAA 
   WHERE EXISTS (SELECT 1
                 FROM BBB
                 WHERE (AAA.date = BBB.date) AND
                       (AAA.idtipo = BBB.idtipo) AND
                       (AAA.tariffario = BBB.tariffario) AND
                       (BBB.IDOrigine = 20 )
                );

这是标准的SQL,应该同时适用于Postgres和Oracle(以及其他数据库)。