Name Value AnotherColumn-----------Pump 1 8000.0 Something1Pump 1 10000.0 Something2Pump 1 10000.0 Something3Pump 2 3043 Something4Pump 2 4594 Something5Pump 2 6165 Something6我的桌子看起來像這樣。我想知道如何為每個(gè)泵選擇最大值。select a.name, value from out_pumptable as a,(select name, max(value) as value from out_pumptable where group by posnumber)g where and g.value = value這段代碼可以完成工作,但是我得到了Pump 1的兩個(gè)條目,因?yàn)樗袃蓚€(gè)具有相同值的條目。
選擇每個(gè)組的最大值
紫衣仙女
2019-09-24 10:47:11