If I've understood you correctly, this might be worth a try as an example...

select min(userid) from
(
select userid
from mhtemp a
where a.userid > 3000
and 0 = (select count(*) from mhtemp b where b.userid = a.userid-1)
)

it survived a very quick test. Basically, the inner pair of selects returns those numbers who have no predecessors. The outer select gets the minimum.

Martin

NIPP, SCOTT V (SBCSI) wrote:

        Well...  The database is actually MySQL.  In answer to a couple
of other questions...  The reason for the number beginning at 3000 is
that this if for a Unix user account system, and we are reserving all
numeric UIDs below 3000.  Thanks again for the feedback.  Still trying
to figure this out.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com






Reply via email to