Richard Baron Penman wrote:

>And then I process it like this, N keys at a time:
>
>SELECT key FROM queue WHERE status=0 LIMIT N;
>BEGIN TRANSACTION;
>for key in keys:
>    UPDATE queue SET status=1 WHERE key=key;
>END TRANSACTION;
>
>
>How can this SELECT and UPDATE be combined more efficiently?

A subselect should work:
update queue set status = 1 where key in (select key from queue where status = 
0 limit N);


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

Reply via email to