我的表格如下:
NetbiosName ProductVersion
Computer1 8
Computer1 9
Computer2 8
Computer2 8
Computer3 7
Computer4 9
Computer4 10
Computer5 7
Computer5 8
Computer6 10
Computer7 8
我想只显示ProductVersion = 8的不同计算机,但只有8才是最大值 对于上面的示例,它应该如下所示:
NetbiosName ProductVersion
Computer2 8
Computer5 8
Computer7 8
答案 0 :(得分:0)
select distinct(NetbiosName),ProductVersion from table where ProductVersion='8'
答案 1 :(得分:0)
你可以这样做:
SELECT
t.NetbiosName,
MAX(t.ProductVersion) as ProductVersion
FROM
table1 as t
GROUP BY
t.NetbiosName
HAVING MAX(t.ProductVersion)=8