On Fri, Mar 26, 2010 at 1:02 AM, Allan Kamau <kamauallan@xxxxxxxxx> wrote: > A classic problem. I would like to assign integer values (from a > sequence) to records in a table based on the order (of contents) of > other field(s) in the same table. Do you have a simple example? (create table, insert some data, then show what the output should look like, or what the data would look like after a transformation that would set the integer value from that sequence. do you mean to set a column in that row with that "integer value (from a sequence)"? or will you be filling a column in some other table with that "integer value..."? what is the function for determining the integer value based on the input data? In fact, what is the input data: do you mean "other field(s) in the same *row*" or do you really mean "table" in that sentence? is your function guaranteed to never have collisions (two rows requiring the same integer)? if there are collisions, how do you handle them? The "problem" isn't specified completely enough for me (probably others too, although one or two might have a hint if they've solved something similar already and so will have enough context to deduce what you mean) to even gain a mental model of just what you're trying to solve. tiger -- Gerald Timothy Quimpo http://bopolissimus.blogspot.com bopolissimus.lists@xxxxxxxxx bopolissimus@xxxxxxxxx Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78" -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general