by Tim Hunt.
Sorry I was not around while you were working this out.
That does look like the right update query.
I don't know why you still have some rows with NULL. It could be that they are 'orphaned' data. That is, the attempt data is still there, but the corresponding quiz was deleted, or something like that.
Also, I still can't think how your site got into that state. The upgrade should just work automatically. Still I am glad you were able to sort it out. (Fingers crossed.)