SQL语句给出错误

时间:2013-03-10 18:07:10

标签: java android database sqlite

我在Android上使用SQLite,在运行此命令时遇到问题:

UPDATE vocab_words SET correct = 5 
WHERE
    name = 'AQA GCSE Spanish Higher',
    foreign_word = 'campo, el',
    english_meaning = 'field, the'

这是什么问题? 提前谢谢。

3 个答案:

答案 0 :(得分:5)

您的SQL查询有语法错误。请更改您的查询:

UPDATE vocab_words SET correct = 5 WHERE name = 'AQA GCSE Spanish Higher', foreign_word = 'campo, el', english_meaning = 'field, the'

为:

UPDATE vocab_words SET correct = 5 WHERE name = 'AQA GCSE Spanish Higher'AND foreign_word = 'campo, el'AND english_meaning = 'field, the'

另外,我建议您使用一些教程阅读SQL的基础知识。这是一个基本错误。

答案 1 :(得分:3)

使用AND而不是comma(,)合并两个或多个简单条件。

  

UPDATE vocab_words SET correct = 5 WHERE name ='AQA GCSE Spanish   更高',foreign_word ='campo,el',english_meaning ='字段,'

替换为

  

UPDATE vocab_words SET correct = 5 WHERE name ='AQA GCSE Spanish   更高'AND foreign_word ='campo,el'和english_meaning ='字段,'

答案 2 :(得分:0)

从最初查看您的帖子时,更新语句应为 -

UPDATE vocab_words SET correct = 5 WHERE name = 'AQA GCSE Spanish Higher' and foreign_word = 'campo, el' and english_meaning = 'field, the'