arunprasadmp
arunprasadmp

Reputation: 33

Using Limit and offset in Sqlite update statmet

update table set column_name limit 3 offset 2;

The above query is not working.

Throws error

sql error: syntax error near 'limit'.

Upvotes: 3

Views: 1641

Answers (2)

Mark
Mark

Reputation: 21

Sqlite does not allow the use of LIMIT and OFFSET statements like in MYSQL. You will have to use a nested query to workaround it . Or use two queries.

Upvotes: 0

CL.
CL.

Reputation: 180172

An UPDATE statement expects a new value after the column_name, like this:

update thetable set column_name = 'some new value'

Furthermore, the documentation mentions that you need to have compiled SQLite with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT option, which is not enabled by default.

Upvotes: 2

Related Questions