Just a quick note, the duplicate entry with the higher ID will be created time and time again when viewing grader reports, but deleting the duplicates with the lower ID's seems to do the trick.
Incredibly useful comment, thanks.
This query was useful to find the course that had duplicate entries and to see what the entries were.
In one case we also had unused mdl_grade_items of type 'category' that needed to be deleted.
As well as very old duplicate mdl_grade_categories that needed to be deleted.
select from_unixtime(gi.timecreated), from_unixtime(gi.timemodified), gi.* from mdl_grade_items gi where
gi.courseid in (
select courseid
from mdl_grade_items
where itemtype = 'course'
group by courseid
having count(*) > 1
)
and gi.itemtype = 'course'
order by gi.courseid;
In one case we also had unused mdl_grade_items of type 'category' that needed to be deleted.
select * from mdl_grade_items
where courseid = my_courseid
and itemtype = 'category';
As well as very old duplicate mdl_grade_categories that needed to be deleted.
select from_unixtime(gc.timecreated), from_unixtime(gc.timemodified), gc.* from mdl_grade_categories gc
where gc.courseid = my_courseid;
Thanks!
In reply to Michael Haskell