select
max(totalrentaltranscations) as MaxTranscations,
firstsortedvalue(staff_id,totalrentaltranscations) as ID
from Table
该函数的名称是什么,它将为我提供与max(totalrentaltranscations)相对应的staff_id
即如果MaxTranscation是2000,那么staff_id有MaxTranscation
答案 0 :(得分:0)
使用order by
+ limit
:
select
staff_id as id,
totalrentaltranscations
from a_table
order by 2 desc
limit 1;