![](/img/trans.png)
[英]get first value of a field based on the max of another field while other max fields are also being used
[英]How to get a field, where another field has is max value
让我有下表
Key |ID | Value
1 |2 | 3
2 |2 | 5
3 |3 | 1
我需要一个查询来获取ID和值,其中值是最大值,我可以在单个查询中执行此操作吗?
像SELECT ID, MAX(Value) FROM table
?
SELECT TOP 1
Key, ID, Value
FROM
MyTable
ORDER BY
Value DESC
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.