select * from (SELECT DISTINCT ClassID,rgbvalue
FROM
(SELECT ClassID,Monday,Tuesday,Wednesday
FROM EDU_CourseTable where ClassID =145) p
UNPIVOT
(rgbvalue FOR mtw IN (Monday,Tuesday,Wednesday))
AS unpvt)t where t.rgbvalue>0;