Bishop Minter
Bishop Minter

Reputation: 107

SQLite3 error: row value missused

I'm trying to use two UPDATE queries on my database:

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');

The first one works just fine but the second one (with multiple entries) gives me the following error:

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

The tutorial that I'm looking at (https://digitalfellows.commons.gc.cuny.edu/2016/04/08/fun-times-with-sqlite-or-a-beginners-tutorial-to-data-management-and-databases-with-sql/) uses the following format for the second query:

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')

But that gives me a syntax error:

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

How can I correct this?

Upvotes: 0

Views: 6002

Answers (1)

Josh Adams
Josh Adams

Reputation: 2099

remove the equals sign:

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')

Upvotes: 1

Related Questions