I see this is an old post, but for the benefit of others looking for a similar solution, Mike, you are correct; you would tag this onto your WHERE clause:
AND u.id=%%USERID%%
So that WHERE line would read in full:
WHERE gi.courseid = c.id AND gi.itemname != 'Attendance' AND u.id=%%USERID%%
Best regards,
Sarah