[postgis-users] add a rank to population statistics- is this a case for a sequence?

fork forkandwait at gmail.com
Thu Apr 7 08:38:55 PDT 2011


Robert Buckley <robertdbuckley <at> yahoo.com> writes:

> 
> Hi,I have a table containing population statistics.I would like to have an
column which automatically updates the rank for each dataset. Would I somehow
use a sequence to calculate this, or is there another way to do this?thanks,Rob

Off the top of my head, I would build a trigger that updates the rank on any
insert/ update/ delete, and I would use  a "window function" [1] to determine
the new rankings.

A sequence just keeps incrementing dumbly, so it wouldn't be a good calculating
thing.

[1] http://www.postgresql.org/docs/current/static/tutorial-window.html



> 
> _______________________________________________
> postgis-users mailing list
> postgis-users <at> postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 







More information about the postgis-users mailing list