I'm trying to make a query that updates the last row in my table. here is the query I'm using:
String updateQuery = "Update table set col = '"+ bla +"' where id=SELECT max(id)";
but this gives mean error..I know how to update last row in SQL but I can't figure it out in SQLITE. What am I missing?
try one of the two options
Option 1
UPDATE table set col = 1 WHERE id = (SELECT MAX(id) FROM table)
Option 2
Split it in two seperate queries. in first make select to take max id, in second update the value using id as a variable
The second option will work for 100%, I'm not sure the first but it should
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