I am using MYSQL. I have two tables in my database.
Table 1: ‘courseTable’ has two colums:
courseId
courseName
Table 2: ‘prereqTable’ has two colums:
courseId
prereqCourseId
Both columns in table 2 correspond to courseId in table 1. I am trying to run a query that will result in a table that contains the courseName for the courseId and the courseName of the prereqCourseId.
I am stuck here:
SELECT `course`.courseName, `prereq`.prereqCourseId FROM `course`
LEFT OUTER JOIN `prereq`
ON `course`.courseId = `prereq`.courseId
You need to join the course table twice with referecing to prereqTable table