Delete many rows from a table using id in Mysql

前端 未结 9 1884
遇见更好的自我
遇见更好的自我 2021-01-30 15:38

I am a Linux admin with only basic knowledge in Mysql Queries

I want to delete many table entries which are ip address from my table using id,

9条回答
  •  日久生厌
    2021-01-30 16:35

    Use IN Clause

       DELETE from tablename where id IN (1,2);
    

    OR you can merge the use of BETWEEN and NOT IN to decrease the numbers you have to mention.

    DELETE from tablename 
    where (id BETWEEN 1 AND 255) 
    AND (id NOT IN (254));
    

提交回复
热议问题