On 2015-10-14 11:20 PM, Don V Nielsen wrote:
> X has columns zip & crrt, just like crrt_net_non.  These form a composite
> key identifying groups within x.  A value "53001.R501" would be an
> example...53001 being the zip code and R501 being the carrier route.  There
> are 52 rows in X that have the key 53001.R501.  A calculation determined
> that I need 42 rows from that key and saved the result in crrt_net_non, the
> row looking like "53001.R501.52.6.46.42".  What I need is a sql function
> that can iterate over crrt_net_non, then grab the rows from X, "53001.R501"
> being first key, sort them into an internal group sequence, then update a
> code of the first 42 rows of that sorted group, and then doing this until
> crrt_net_non is exhausted.

Hi Don, usually a CTE can be pressed into service to make things work. 
Maybe others know exactly what you mean here but it's a bit Greek to me.

As Igor suggested - perhaps some data to accompany this schema and an 
example result-set (or resulting updated table) from it will make it 
clear what you want to achieve with the query. Feel free to simplify so 
the essence of what is needed remain, but be sure to give an example 
that cannot be achieved by other arbitrary means.


Reply via email to