Find a Nth highest or lowest number in a given series of numbers using TSQL

Rajnilari2015
Posted by Rajnilari2015 under Sql Server category on | Points: 40 | Views : 185
DECLARE @T TABLE(Number FLOAT)
INSERT INTO @T VALUES(1),(2.06),(-36.4),(-4),(5.90),(618.9),(79.8),(8),(9),(18.0),(23.7)
SELECT HighestNumber=MAX(Number), LowestNumber=MIN(Number)
FROM @T


HighestNumber	LowestNumber
618.9 -36.4

Comments or Responses

Login to post response