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