skip to Main Content

I want to be able to delete records from a table where ID is from 7970 to 9805 if sales amount is between 200 and 850.

I need your help.

Thank you in advance.

Here’s my individual mysql delete statements.

DELETE FROM `fin_sales` WHERE `sale_id` BETWEEN 7970 AND 9805;

DELETE FROM `fin_sales` WHERE `total` BETWEEN 200 AND 850;

but its not working

2

Answers


  1. I believe, you need to make one delete statement as below:

    DELETE FROM fin_sales WHERE sale_id BETWEEN 7970 AND 9805 and total BETWEEN 200 AND 850;
    

    I have not tested it so use it on your own discretion

    Login or Signup to reply.
  2. Please try the below query

    DELETE FROM `fin_sales` WHERE `sale_id` BETWEEN 7970 AND 9805 AND `total` BETWEEN 200 AND 850;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search