Postgres 8.4
DELETE
FROM processing_transaction AS pt
INNER JOIN processing_transaction_movement AS ptm
ON pt.processing_transaction_id = ptm.processing_transaction_id
LEFT OUTER JOIN test_package tesp ON pt.test_package_id = tesp.test_package_id
LEFT OUTER JOIN test_batch tbat On tesp.test_batch_id = tbat.test_batch_id
WHERE pt.processing_transaction_type = 'TEST';
我收到以下错误:
错误:>>INNER<< LINE 1 处的语法错误:DELETE FROM processing_transaction AS pt INNER JOIN processi...
请你能帮我找出我的 SQL 查询中的错误吗
感谢您对@desislavkamenov @jan 的支持。现在我用这个:
开始工作;
从 processing_transaction AS pt 使用 processing_transaction_movement AS ptm,test_package testp,test_batch tbat 删除 pt.processing_transaction_type = 'TEST';AND pt.processing_transaction_id = ptm.processing_transaction_id AND pt.test_package_id = tesp.test_package_id AND tesp.test_batch_id = tbat.test_batch_id
回滚;
但是我需要从两个表(processing_transaction 和 processing_transaction_movement)中删除数据,我一直在寻找这样的想法,发现我可以使用“ON DELETE CASCADE”来做到这一点。但我不知道如何在这里使用它。所以请再次帮助我。