Yes, I did delete the 6300 records before attempting the 2.1 or 2.2 (I tried both) upgrade.
But I still get the "Cannot insert duplicate key row in object 'dbo.mdl_question_attempt_steps' with unique index 'mdl_quesattestep_queseq_uix'" error when attempting the upgrade AFTER having deleted those 6300+ records.
What actually happened was:
I ran the query:
SELECT question, attempt, seq_number, COUNT (seq_number) AS NumOccurrences FROM mdl_question_states GROUP BY question, attempt, seq_number HAVING (COUNT(seq_number) > 1 )
It returned the 6300 rows (ok it was about 6280). I deleted those.
I ran the above query again. It returned about another 1000 rows.
I deleted those.
I ran the query again. It returned about 600 rows.
I deleted those and ran the query again. It returned about 250 rows.
I kept on re-running the query over and over again and deleting the rows that it returned each time until the query finally returned 0 rows. I had to run the delete statement about 7 or 8 times before 0 rows were returned.
So it's actually more than 6300 records. I've got the exact numbers written down at the office, which I can post here if you want.
But after doing all this the upgrade to 2.1 or 2.2 still fails with the "duplicate key row" error. So there's still some "bad" data that the above query isn't catching.