Name Value AnotherColumn
-----------
Pump 1 8000.0 Something1
Pump 1 10000.0 Something2
Pump 1 10000.0 Something3
Pump 2 3043 Something4
Pump 2 4594 Something5
Pump 2 6165 Something6
Mi mesa se parece a esto. Me gustaría saber cómo seleccionar el valor máximo para cada bomba.
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
este código hace el trabajo, pero obtengo dos entradas de la Bomba 1 ya que tiene dos entradas con el mismo valor.
GROUP BY. En estricto,GROUP BYtodas las columnas de suSELECTdeben aparecer en suGROUP BYo usarse en una función agregada.