TSQL Challenge 15 - Solution by Madhangi Ramasamy



-- File Name: Madhangi_Ramasamy_tsqlchallenge_15.sql
select	Row,
	[1], [2], [3], [4], [5], [6], [7], [8], [9]
from(	select	Row
	,	Col
	, 	case when row % col = 0 then 'X' else ' ' end Display
	from	@Rows
	Cross	join @Cols) as a
pivot(	min ( Display)
	for Col in ([1], [2], [3], [4], [5], [6], [7], [8], [9])) as p

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.