为什么此DELETE查询给我一个语法错误?

时间:2018-12-28 09:39:16

标签: mysql sql database

我正在尝试从表中删除行,但一直收到语法错误,我不确定为什么。

这是我的查询:DELETE * FROM questions WHERE catid = '680'

这是我的表结构:

id (primary key, auto increment)
question
catid
ordering

通过上面的查询,我得到这个错误:

There was an error running the query [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM questions WHERE catid = "680"' at line 1]

表中有两行,其中catid = 680和679。

2 个答案:

答案 0 :(得分:3)

尝试以下-

DELETE FROM questions 
  WHERE catid = 680

答案 1 :(得分:2)

应该是

DELETE FROM questions WHERE catid = '680'