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,
DELETE FROM table_name WHERE id BETWEEN 1 AND 256;
Try This.
Others have suggested IN
, this is fine. You can also use a range:
DELETE from tablename where id<254 and id>3;
If the ids to delete are contiguous.
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));