1

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.

1

3 Answers 3

1

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;
Sign up to request clarification or add additional context in comments.

Comments

1

Try this

Delete C From ClientFlags cf, Client c where cf.lientId=c.Id and email=3 and flagId=42;

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.