I'm trying to get the second value as the second largest value in Esper. But, unfortunately, it says the nested subquery is not working. So, how can I get the second largest value in Esper?
My Query is as follows:
SELECT max(averageTemperature) as Temp1,
(
select max(jfk_alias.averageTemperature)
from jfk as jfk_alias
where jfk_alias.averageTemperature not in (
select max(averageTemperature)
from jfk)
) as Temp2
FROM JFK
You can use windows functions to order the
averageTemperatureby descending order, then select the 2nd row.EDIT :
dense_rankinstead ofrow_numberper Andrew's suggestion