sql >> Base de Datos >  >> RDS >> PostgreSQL

Devolver todos los registros históricos de cuentas con cambios en el valor específico asociado

Creo que quieres funciones de ventana para comparar el valor:

select t.*
from (select t.*,
             min(t.value) over (partition by t.acct_id) as min_value,
             max(t.value) over (partition by t.acct_id) as max_value
      from t
     ) t
where min_value <> max_value;