TSQL Challenge 15 - Solution by Arumugam Thiraviam



-- File Name: Arumugam_Thiraviam_TSQLChallenge_15.sql
SELECT * FROM 
(
	SELECT *, CASE WHEN Row % Col = 0 THEN 'x' ELSE '' END c  from @Rows R CROSS JOIN @Cols C
)A
PIVOT 
(
	MAX(c) FOR Col in ([1], [2], [3], [4], [5], [6], [7], [8], [9])
) pvt

Did you find something incorrect/wrong with this solution? Take a few seconds to Report It.

Did you understand how this solution work? If you find it difficult to understand, you can Request an Explanation or you can Write an explanation to help others better understand this solution.