This question is definitely not in the best forum, but still.
I would not do Query 1 like that. I think the thing you should be using, but are not, is the prefix_course_modules table (joined to the prefix_module table).
I would not do Query 1 like that. I think the thing you should be using, but are not, is the prefix_course_modules table (joined to the prefix_module table).