I have schedules of class times and I place the course id in the classtimes. When I run the query I see that in 30 minute times what courses are scheduled, but in the results I want to see the name not the id.
SELECT TOP (2000) classtimes.classtime_id, classtimes.classroom_id, classtimes.location_id, classtimes.classtime_day, classtimes.timec_9, classtimes.timec_95, classtimes.timec_10, classtimes.timec_105,
classtimes.timec_11, classtimes.timec_115, classtimes.timec_12, classtimes.timec_125, classtimes.timec_13, classtimes.timec_135, classtimes.timec_14, classtimes.timec_145, classtimes.timec_15,
classtimes.timec_155, classtimes.timec_16, classtimes.timec_165, courses.course_name FROM classtimes INNER JOIN
courses ON classtimes.timec_10 = courses.course_id
If it finds a match I would like it to display the course_name instead of the course_ID
I will add a screen shot of the results

In this query we are looking for classes in the 10 am time frame and it finds 5 matchs and displays them. I can see the course names off to the side but I would like to see them in the timec_10 field.

classtimestable is wrong, it should have been justclassroom_id, location_id, day, timecolumns, then you only need one join and a pivot – Charlieface May 28 '23 at 11:43FROM classtimes ct JOIN courses c ON c.course_id = ct.course_idthen you pivot it up byclassroom_idandday(in each row) and show a value for each individualtimein a separate column. All one query something like this https://dbfiddle.uk/rswpaSNN – Charlieface May 29 '23 at 19:57