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.
On Wed, Oct 14, 2015 at 4:03 PM, Igor Tandetnik <igor at tandetnik.org> wrote: > On 10/14/2015 4:49 PM, Don V Nielsen wrote: > >> What am I looking to do? Using a table X, I've built a summary table, >> calculating a value called net_non_pieces. net_not_pieces is a qty of >> rows >> from a group rows that needs to be recoded to a different value. So what >> I >> want to do is for each group in X, look up the calculated value in >> crrt_net_non, then grab the first net_non_pieces (sequenced, of course) >> and >> apply a code to those rows, leaving the remaining rows alone. >> > > It might help if you show the definition of X, a sample of data in it, and > the desired result of the query over that data. I, for one, have difficulty > following your description. > -- > Igor Tandetnik > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >