4 ms·
Isn’t this what the LAST_VALUE window function does? If so, that’s a standardized SQL syntax which is supported in both postgresql and recent versions of MySQL.
by profquail 7y ago
Isn’t this what the LAST_VALUE window function does? If so, that’s a standardized SQL syntax which is supported in both postgresql and recent versions of MySQL.
https://www.postgresqltutorial.com/postgresql-last_value-function/ https://www.postgresqltutorial.com/postgresql-last_value-fun...
- zeroimpl 7y agokinda. You can use aggregates as window functions, but cannot use window functions as aggregates. So it would be: select a, last_value(b) over(partition by a), last_value(c) over(partition by a) from table Note the lack of a "GROUP BY" so this will result in duplicates unless you add a DISTINCT.