I'm working on a simple todo app that has a column for each day of the week. On startup, the app checks to see if there are any incomplete tasks from before the current date. If so, they're moved to the top of the current date's column.
The app is cloud-based, but the tasks are backed up for offline mode with an SQLite db. I can easily move the tasks by updating their date property, but I need the order property of each task to increment starting at 0 to place them at the top.
I need to be able to define a count variable in SQLite alone and increment it with each update that's performed. I know this code doesn't work, but it's an easy way of explaining what needs to be done:
count = 0
UPDATE `tasks`
SET `date` = '2010-01-04',
`order` = `count`++
WHERE `date` < '2010-01-04'
I'd rather not use a temporary table or use a counter outside of SQLite, if possible.
@OMG Ponies - I'm starting to think it's just not possible all in SQLite. Here's a visual to better explain what I'd like to do: http://post.ly/HGI2