Only single result allowed for SELECT that is part of an expression
I am trying to execute the following Sqlite query:
SELECT * FROM monsters WHERE ( uid IN added_monsters )
with this table:
create table if not exists added_monsters(STRING name, INTEGER uid)
but I get the error "only one result allowed for a SELECT that is part of an expression".
+3
GeekPeek
source
to share
2 answers
I just needed to do an INNER JOIN to get the information I needed: "SELECT * FROM monsters INNER JOIN added_monsters ON monsters.uid = added_monsters.uid;"
+4
GeekPeek
source
to share
added_monsters
has two columns, so the database doesn't know which one to check with IN.
You need to extract one column:
SELECT * FROM monsters WHERE uid IN (SELECT uid FROM added_monsters)
+10
CL.
source
to share