On 1 Nov 2013, at 4:54am, Igor Tandetnik <i...@tandetnik.org> wrote:

> There is, but you probably won't like it.
> 
> update myTable set currentOrder = 1 +
>   (select count(*) from myTable t2 where [t2 row comes before myTable row 
> according to order details]);

You're right.  I don't like it.  But I have nothing better.  Drat.

> It would likely be much faster to do it in the application code. Iterate over 
> the SELECT you've shown, and run
> 
> update myTable set currentOrder = :nextValue where rowid=:currentRow;

So it would be reasonable to do something like

SELECT group_concat(rowid) FROM myTable ORDER BY [whatever]

then I could iterate through the values returned as you write.  That seems to 
be the best I could come up with, but if anyone has a faster or more elegant 
solution I'd love to see it.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to