I've got a query returning 200 random distinct foo from my Database. I want to update the notes field for those rows.
select distinct on (foo, random()) *
from test
order by random(), foo
limit 200
update test
notes = 'Flag'
order by random()
limit 200
My first thought was to use order and limit inside update, but those don't work there. Another option I thought was to use the select inside the update.
But I'm not really sure, that's why I came here. Any ideas to get sql to update 200 distinct random rows would be great.