DELETE FROM CommissPlanF
WHERE CommissPlanID = (SELECT dbo.CommissPlan.CommissPlanID
WHERE dbo.CommissPlan.CP_CommissPlan = 'test')
答案 0 :(得分:1)
您可以将两个表连接在一起,而不是使用子查询:
DELETE CommissPlanF
FROM CommissPlanF f
INNER JOIN dbo.CommissPlan c ON c.CommissPlanID = f.CommissPlanID
AND c.CP_CommissPlan = 'test'
答案 1 :(得分:0)
您可以在此处使用INNER JOIN
(假设是SQL Server)。
DELETE cpf
FROM dbo.CommissPlanF cpf
INNER JOIN dbo.CommissPlan cp ON cp.CommissPlanID = cpf.CommissPlanID
WHERE cp.CP_CommissPlan = 'test'