嘿傢伙,我想是這樣的:MySQL的加入,而不是子查詢
DELETE FROM ClientsFlags
WHERE clientId = (SELECT id
FROM Client
WHERE emailRegistrationToken = 3)
AND flagId = 42;
但隨着聯接,而不是子查詢。我對聯接不太好,所以請幫助我。
嘿傢伙,我想是這樣的:MySQL的加入,而不是子查詢
DELETE FROM ClientsFlags
WHERE clientId = (SELECT id
FROM Client
WHERE emailRegistrationToken = 3)
AND flagId = 42;
但隨着聯接,而不是子查詢。我對聯接不太好,所以請幫助我。
這裏是一個連接的版本,
DELETE a
FROM ClientsFlags a
INNER JOIN Client b
ON a.clientId = b.id
WHERE b.emailRegistrationToken = 3 AND
a.flagId = 42;
你應該嘗試這樣的事:
DELETE C FROM ClientsFlags AS CF
JOIN Client AS C ON C.Id=CF.clientId
WHERE email=3 and flagId=42
試試這個
Delete C From ClientFlags cf, Client c where cf.lientId=c.Id and email=3 and flagId=42;
[你嘗試過什麼?](HTTP ://www.whathaveyoutried.com/)請參見[ask advice](http://stackoverflow.com/questions/ask-advice)。 –