SQL SQLite - SELECT TOP 语法错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5406303/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQLite - SELECT TOP syntax error
提问by ryyst
I'm trying to use the statement SELECT TOP 1 * FROM tasks WHERE dueDate < ?1 ORDER BY dueDate DESCbut SQLite says near "1": syntax error. What's wrong?
我正在尝试使用该语句,SELECT TOP 1 * FROM tasks WHERE dueDate < ?1 ORDER BY dueDate DESC但 SQLite 说near "1": syntax error. 怎么了?
回答by moinudin
Use LIMIT 1at the end of the query instead of TOP 1(which isn't valid sqlite syntax).
LIMIT 1在查询末尾使用而不是TOP 1(这不是有效的sqlite 语法)。
You might also need to remove the ?in dueDate < ?1, but I don't know sqlite well enough to be sure.
您可能还需要删除?in dueDate < ?1,但我不太了解 sqlite 无法确定。

