0

The following doesnt work in mysql, any alternate way:

DELETE  FROM _ResourceUsageData 
WHERE RowNo >
(SELECT MIN(RowNo) FROM 
_ResourceUsageData 
WHERE
ResourceInstanceStatus = 'Deleted');
1
  • @chanchal118 I don't think this is a duplicate, the question you link to is resolved by using the proper syntax and does contain the table being deleted from in the subquery. Commented Dec 21, 2013 at 7:07

1 Answer 1

2

In Mysql you can't select from a table you are deleting from. But you can trick it with another subquery.

DELETE FROM _ResourceUsageData 
WHERE RowNo > 
(
    select * from 
    (
        SELECT MIN(RowNo) 
        FROM _ResourceUsageData 
        WHERE ResourceInstanceStatus = 'Deleted'
    ) x
)
Sign up to request clarification or add additional context in comments.

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.