Re[2]: Updating Random Records

2001-07-09 Thread Werner Stuerenburg
> Right that's why I want to do a query which updates the picked field > by setting it to 1 in 5000 random records where picked is null. Then I do > a query to pull those 5000 out. Then I do a query to update picked to 0 > where picked = 1. So is there a way to update a random number of records

Re: Updating Random Records

2001-07-09 Thread Werner Stuerenburg
I don't think this will work as you expect. You will have to mark those that you picked from those you haven't picked (and marked) before. > SELECT * FROM 5600k WHERE picked IS NULL ORDER BY rand() LIMIT 5000; > But what I really want to do is: > UPDATE 5600k SET picked=1 WHERE picked IS NULL O

Updating Random Records

2001-07-09 Thread Roger Ramirez
Is there a way to update random records? I have a database of 5.6 million records and I want to pull out 5000 records and mark a field in the database that I've pulled these so that I don't pull the same 5000 again. I know I can select the records by doing: SELECT * FROM 5600k WHERE picked IS N