I'm trying to put a select within a select within a select.
Here's an example of what I'm trying to do.
DECLARE @TEMP TABLE (I INT, K INT)
INSERT INTO @TEMP
SELECT 1, 2 UNION SELECT 1, 3 UNION SELECT 1, 5 UNION
SELECT 2, 1 UNION SELECT 2, 3 UNION SELECT 2, 7 UNION
SELECT 3, 3 UNION SELECT 3...