您需要一个关联子句:
select hs.Id, hs.Name, hs.HoursSpent, hs.Date
from HoursSpent hs
where hs.HoursSpent = (select max(hs2.HoursSpent)
from HoursSpent hs2
where hs2.name = hs.name
-----------------------------^ this is the correlation clause
);
这表示对于每个name
in HoursSpent
,选择具有最大值的行HoursSpent
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句