Update Query with limit cause SQLite

前端 未结 1 1282
[愿得一人]
[愿得一人] 2021-02-08 19:37

i have table in SQLite named TBL_data

i have two fields id and name

All id is set to the -1

i want to update first occurrence of record

for t

相关标签:
1条回答
  • 2021-02-08 19:56

    That query works only if you have compiled SQLite with SQLITE_ENABLE_UPDATE_DELETE_LIMIT.

    If this is not the case, you have to use some unique key of your table to determine the rows:

    UPDATE tbl_data
    SET ...
    WHERE rowid IN (SELECT rowid
                    FROM tbl_data
                    WHERE ...
                    ORDER BY ...
                    LIMIT 1)
    
    0 讨论(0)
提交回复
热议问题