[英]Value of id corresponding to max value of another column
select
max(totalrentaltranscations) as MaxTranscations,
firstsortedvalue(staff_id,totalrentaltranscations) as ID
from Table
該函數的名稱是什么,它將給我與max(totalrentaltranscations)相對應的staff_id
也就是說,如果MaxTranscation為2000,那么staff_id擁有MaxTranscation
order by
+ limit
使用order by
:
select
staff_id as id,
totalrentaltranscations
from a_table
order by 2 desc
limit 1;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.