Reputation: 293
Hey guys I want to something like this:
DELETE FROM ClientsFlags
WHERE clientId = (SELECT id
FROM Client
WHERE emailRegistrationToken = 3)
AND flagId = 42;
But with a join rather than the sub query. I'm not very good with joins so please help me out.
Upvotes: 1
Views: 58
Reputation: 8553
Try this
Delete C From ClientFlags cf, Client c where cf.lientId=c.Id and email=3 and flagId=42;
Upvotes: 1
Reputation: 2214
You should try something like this :
DELETE C FROM ClientsFlags AS CF
JOIN Client AS C ON C.Id=CF.clientId
WHERE email=3 and flagId=42
Upvotes: 0
Reputation: 263703
here is a join version,
DELETE a
FROM ClientsFlags a
INNER JOIN Client b
ON a.clientId = b.id
WHERE b.emailRegistrationToken = 3 AND
a.flagId = 42;
Upvotes: 1