I am trying to run a SQL query to delete rows with id's 163 to 265 in a table
I tried this to delete less number of rows
DELETE FROM `table` WHERE id IN (264, 265)
But when it comes to delete 100's of rows at a time, Is there any query similar to above method I am also trying to use this kind of query but failed to execute it
DELETE FROM `table` WHERE id IN (SELECT * FROM table WHERE id = )
Please tell me the query to do the above action...
Please try this:
If you need to delete based on a list, you can use
IN
:If you need to delete based on the result of a query, you can also use
IN
:(Notice that the subquery must return only one column)
If you need to delete based on a range of values, either you use
BETWEEN
or you use inequalities:or
You can use
BETWEEN
:Get string value delete