CREATE TABLE [dbo].[TestCourses](
[Dow] [nvarchar](50) NOT NULL,
[Course] [nvarchar](50) NOT NULL
) ON [PRIMARY]
GO
INSERT INTO TestCourses (Dow, Course) VALUES ('Monday','Science')
INSERT INTO TestCourses (Dow, Course) VALUES ('Monday','Math')
INSERT INTO TestCourses (Dow, Course) VALUES ('Tuesday','LA')
INSERT INTO TestCourses (Dow, Course) VALUES ('Tuesday','Science')
INSERT INTO TestCourses (Dow, Course) VALUES ('Tuesday','Gym')
INSERT INTO TestCourses (Dow, Course) VALUES ('Wednesday','Science')
INSERT INTO TestCourses (Dow, Course) VALUES ('Wednesday','Math')
INSERT INTO TestCourses (Dow, Course) VALUES ('Wednesday','Gym')
INSERT INTO TestCourses (Dow, Course) VALUES ('Wednesday','LA')
INSERT INTO TestCourses (Dow, Course) VALUES ('Thursday','Science')
INSERT INTO TestCourses (Dow, Course) VALUES ('Thursday','LA')
INSERT INTO TestCourses (Dow, Course) VALUES ('Friday','Science')
INSERT INTO TestCourses (Dow, Course) VALUES ('Friday','LA')
INSERT INTO TestCourses (Dow, Course) VALUES ('Friday','Math')
SELECT * FROM
(
SELECT
Dow,
Course
FROM
TestCourses
) as Source
PIVOT (
MIN(course)
FOR dow in (Monday, Tuesday, Wednesday, Thursday, Friday)
) As pvt
Output should be: Column headers should be the day of the week and under them are listed all the courses for each day. My pivot query above only gives me one course for each day.