SQLite - SELECT TOP syntax error

SqlSqlite

Sql Problem Overview


I'm trying to use the statement SELECT TOP 1 * FROM tasks WHERE dueDate < ?1 ORDER BY dueDate DESC but SQLite says near "1": syntax error. What's wrong?

Sql Solutions


Solution 1 - Sql

Use LIMIT 1 at the end of the query instead of TOP 1 (which isn't valid sqlite syntax).

You might also need to remove the ? in dueDate < ?1, but I don't know sqlite well enough to be sure.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionryystView Question on Stackoverflow
Solution 1 - SqlmoinudinView Answer on Stackoverflow