Martin's answers are concise and smart, but I will add two more approaches that might be easier to analyze, depending on what you usually read.
Without any assumptions about your scheme:
SELECT DISTINCT
course_id
FROM
MyTable AS T1
WHERE
term_id = 1
AND EXISTS (SELECT * FROM MyTable AS T2 WHERE T1.course_Id = T2.course_id AND T2.term_id = 2)
If, as I believe, {course_id, term_id} is unique, you can also do this:
SELECT
T1.course_id
FROM
MyTable AS T1
INNER JOIN MyTable AS T2 ON T1.course_id = T2.course_id
WHERE
T1.term_id = 1
AND T2.term_id = 2
user565869
source
share