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 this i have used
update TBL_data set name = 'XYZ' where id = -1 limit 1
it shows error, is there any other way ?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With