php删除从id 9809到id 17275的mysql行

时间:2018-01-22 08:43:28

标签: php mysql

如何从id 9809删除mysql行到id 17275?

sql =" DELETE from Table WHERE id = 9809 to id= 17275"

如何从开始id删除到结束ID?

3 个答案:

答案 0 :(得分:3)

如果要删除可在

之间使用的一系列数值
  sql =" DELETE from Table WHERE id between  9809 and  17275"

答案 1 :(得分:1)

一定是

$sql = " DELETE from Table WHERE id between 9809 and 17275"

答案 2 :(得分:0)

DELETE from Table WHERE cast(id as unsigned) >= 9809 and  cast(id as unsigned)<=17275;