Perfect! Wonderful.

Thanks Igor.


2013/10/14 Igor Tandetnik <i...@tandetnik.org>

> On 10/14/2013 11:36 AM, Gert Van Assche wrote:
>
>> my table contains a boolean SubGroup field that is set to 0 by default.
>> I would like to update it so that for instance 100 of the 1000 records are
>> randomly set to 1.
>> Is this something that can be done using an SQL instruction?
>>
>
> Try something like this:
>
> update MyTable set SubGroup=1 where rowid in (
>   select rowid from MyTable order by random() limit 100
> );
>
> --
> Igor Tandetnik
>
> ______________________________**_________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to