JOIN
を使用する
DELETE e1
FROM Employee AS e1
JOIN (SELECT deptID
FROM Employee AS e
JOIN Sales AS s ON e.ID = s.ID
GROUP BY deptID
HAVING SUM(Sales) <= 400) AS d
ON e1.deptID = d.deptID
JOIN
を使用する
DELETE e1
FROM Employee AS e1
JOIN (SELECT deptID
FROM Employee AS e
JOIN Sales AS s ON e.ID = s.ID
GROUP BY deptID
HAVING SUM(Sales) <= 400) AS d
ON e1.deptID = d.deptID