I just thought id post this to save other people all the time it took me to get this working. This query will give you a list of all users who have completed an activity with a mark of 80% or higher.
Username - Firstname - Lastname - Activity name - Date marked - Final Grade
The date marked will be the date it was submitted or graded in gradebook. Final grade is after all changes and scaling have been done. Use this with the Ad-hoc queries module and its great.
SELECT
prefix_user.username AS 'Employee ID',
prefix_user.firstname AS Firstname,
prefix_user.lastname AS Lastname,
prefix_grade_items.itemname AS Lesson,
date(from_unixtime(prefix_grade_grades.timemodified)) AS 'Date Completed' ,
Max(Convert(prefix_grade_grades.finalgrade,signed)) as Grade
FROM prefix_grade_grades
JOIN prefix_user
ON prefix_grade_grades.userid = prefix_user.id
JOIN prefix_grade_items
ON prefix_grade_grades.itemid = prefix_grade_items.id
Where prefix_grade_grades.finalgrade > 79
AND prefix_grade_items.itemname = "**assignment name here**"
GROUP BY prefix_user."**unique identifier usually loginID**"
order by prefix_user.lastname asc