Código SQL:
Ver originalCREATE TABLE #temp
(
id INT
)
INSERT INTO #temp VALUES (1)
INSERT INTO #temp VALUES (2)
INSERT INTO #temp VALUES (3)
INSERT INTO #temp VALUES (4)
SELECT * FROM(
SELECT top 1 id FROM #temp ORDER BY id DESC
)t1
UNION ALL
SELECT * FROM(
SELECT top 1 id FROM #temp ORDER BY id ASC) t2
saludos!