DELETE TableA FROM TableA a INNER JOIN TableB b on b.Id = a.Id where title like 'test'
以上就是我想出来的,但是我一直在努力
The DELETE statement conflicted with the REFERENCE constraint
我想如果我将两个表合并在一起,那么我将同时删除两个表,并且没有任何约束会发生冲突.
我在查询中遗漏了什么吗?
DELETE FROM TableB WHERE Id IN ( SELECT Id FROM TableA WHERE title = 'test') DELETE FROM TableA WHERE title = 'test'
当您在TableB中仍有引用时,引用约束阻止您删除TableA中的行