View Single Post

   
  #2 (permalink)  
Old 05-07-2008, 10:16 AM
cvh@LE
 
Posts: n/a
Default Re: How to find holes in a sequence?

On May 5, 9:00*pm, Steve Ackman <st...@SNIP-THIS.twoloonscoffee.com>
wrote:
> * I've got a leafnode directory with usenet articles
> named, roughly, 1-79389.
>
> After running a sh script on the directory to populate a
> table with various headers and the full article, I have,
>
> mysql> select count(*) from rcm;
> +----------+
> | count(*) |
> +----------+
> | * *79303 |
> +----------+
> 1 row in set (0.00 sec)
>
> and an actual article count on the directory of 79347.
>
> * Obviously, there are 44 articles that for some
> reason or other, failed the INSERT (and an additional
> 42 that don't exist as filenames). *Given that
> server_id (mediumint) is assigned the filename of the
> article, how can I find which numbers between 1 and
> 79389 *don't* exist as server_id?


I'm a bit unsure whether I correctly understand what you try to
accomplish,
but given you have a table with all numbers 1..79389 you could simply
run a denying left join query on both tables
like:

select
f.id as missing
from fulltable f left join leafnodes l on f.id=l.nodeid
where isnull(l.nodeid)

but I am afraid I'm missing the point here

Reply With Quote