DELETE FROM mytable WHERE id IN (SELECT id FROM mytable where roll=1)
I have a table mytable. My above query is throwing an error.
You can’t specify target table ‘mytable’ for update in FROM clause
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the MySQL documentation:
Fortunately, you don’t need the subquery. Just do:
It’s much shorter and clearer to boot.