1.0.0 • Published 8 years ago
last-agg v1.0.0
unique-agg
last non null data agreggate function for postgres
Case of use
You want to repeat the value of some field if the next row has a null
.
id | country | city |
---|---|---|
1 | Base Antártica | |
2 | Argentina | Buenos Aires |
3 | Córdoba | |
4 | Rosario | |
5 | Uruguay | Montevideo |
select id, last_agg(country) over (order by id), city
from cities
order by id;
id | country | city |
---|---|---|
1 | Base Antártica | |
2 | Argentina | Buenos Aires |
3 | Argentina | Córdoba |
4 | Argentina | Rosario |
5 | Uruguay | Montevideo |
Install
psql < bin/create_last_agg.sql
License
1.0.0
8 years ago