I have following query which select from employee table where name is "max" and ID not in 123 and 444. Not in IDs can grow in future. But I am receiving error as
Error
( 8023): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: DatabaseException(near "?": syntax error (code 1 SQLITE_ERROR): , while compiling:
Query
List<String> a = [];
a.add("123");
a.add("444");
var table = await mydb.rawQuery(
"SELECT value from employee WHERE employeename = ? AND id NOT IN ? ORDER BY timestamp DESC",
["max", a]);
LIST
value fixed? I mean is it 2 always? If so,one way is that the parameter (?
) should match no of values. something like..NOT IN (?,?) ...
and put the values inwhereArgs: a
or you have to join the values with,
..something likeid IN (${a.join(', ')})
– Arun Palanisamy