The only reason NUM exists in the result set is so I could use it to limit the outer most select.
But I am having problems with the LIMIT statement. It throws an exception no matter what table alias is used: X or x2. It says "no such column". Thanks for your time, by the way. On Wed, Oct 14, 2015 at 6:08 PM, Igor Tandetnik <igor at tandetnik.org> wrote: > On 10/14/2015 6:24 PM, Don V Nielsen wrote: > >> zip crrt version_id NUM segment >> [truncated num 1..38] >> 53001 R501 0060 39 xx >> 53001 R501 0060 40 xx >> 53001 R501 0060 41 xx >> 53001 R501 0060 42 xx >> [truncated num 1..24] >> 53001 R502 0060 21 xx >> 53001 R502 0060 22 xx >> 53001 R502 0060 23 xx >> 53001 R502 0060 24 xx >> > > select * from addresses X where rowid in ( > select x2.rowid from addresses x2 where X.zip=x2.zip and X.crrt=x2.crrt > order by (CASE ...) > limit ifnull( ( > select net_non_pieces from crrt_net_non net > where X.zip=net.zip and X.crrt=net.crrt > ), 0) > ); > > Do you actually need NUM column in the resultset? That one would be tricky > to pull off. > -- > Igor Tandetnik > > > _______________________________________________ > sqlite-users mailing list > sqlite-users at mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users >