
现在有一张表,如上图所示。经过如下的sql语句处理:
select airline,airlinenum, MAX(CASE beforedates when 1 then price END) AS beforedate1price,MAX(CASE beforedates when 2 then price END) AS beforedate2price
from airline6 GROUP BY airline,airlinenum
得到如下的数据。

得到的beforedate1price和beforedate2price都是group by之后最大的那个。而我现在想要得到inserttime为最大所对应的那个价格,sql该怎么写?