SQLite3错误:行值未使用

时间:2017-07-28 15:52:52

标签: sqlite sqlitestudio

我正在尝试在我的数据库上使用两个UPDATE查询:

UPDATE equipment
SET equip_level = 'Hero'
WHERE equip = ('Amulet of Immortality');

UPDATE equipment
SET equip_level = 'Master'
WHERE equip = ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death');

第一个工作正常,但第二个(有多个条目)给出了以下错误:

[11:37:16] Error while executing SQL query on database 'test': row value misused

我正在查看的教程(https://digitalfellows.commons.gc.cuny.edu/2016/04/08/fun-times-with-sqlite-or-a-beginners-tutorial-to-data-management-and-databases-with-sql/)对第二个查询使用以下格式:

UPDATE equipment
SET equip_level = 'Master'
WHERE equip = IN ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death')

但是这给了我一个语法错误:

[11:49:48] Error while executing SQL query on database 'test': near "IN": syntax error

我该如何纠正?

1 个答案:

答案 0 :(得分:1)

删除等号:

UPDATE equipment
SET equip_level = 'Master'
WHERE equip IN ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death')