How to query boolean use SQL?
Answered
mb.runSQLQuery(`
SELECT * FROM daily where index = true;
`).sort({date:-1})
.limit(100)
OR:
SELECT * FROM daily where index is true;
col 'index' is boolean,but when execute it , return messge:
{
"message" : "SyntaxError: Line: 1 Column: 32, Expected [A-Za-z0-9_:] or [A-Za-z0-9_] but ' ' found.",
"stack" : "script:2:4",
"sql" : "SELECT * FROM daily where index is TRUE )",
"___" : " ^ ",
"location" : {
"start" : {
"offset" : 31,
"line" : 1,
"column" : 32
},
"end" : {
"offset" : 32,
"line" : 1,
"column" : 33
}
}
}
Both of these methods are OK.
or
I noticed that there is an extra closing parenthesis in the SQL statement executed, which is not correct."sql" : "SELECT * FROM daily where index is TRUE )",
I can't reproduce the problem locally. Can you provide a complete reproduction step, including sample data and a complete script?
Both of these methods are OK.
or
I noticed that there is an extra closing parenthesis in the SQL statement executed, which is not correct."sql" : "SELECT * FROM daily where index is TRUE )",
I can't reproduce the problem locally. Can you provide a complete reproduction step, including sample data and a complete script?
Replies have been locked on this page!