I'm trying to put a select within a select within a select.
Here's an example of what I'm trying to do.
Here's an example of what I'm trying to do.
Code:
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, 3 UNION SELECT 3, 2
--Can I somehow make this work?
SELECT ( SELECT MAX(J) FROM (SELECT MIN(K) AS J FROM @TEMP B GROUP BY I) ) FROM @TEMP A