FYI-
I believe inline views in mysql will require at least version 5.
Thanks,
Ron.

"To really screw up Linux you have to work at it...To really screw up Windows, you 
have to work ON
it."
"The software said to install Windows 98 or better... So I installed linux."
"Windows - How do you want to be exploited today?"
"Friends don't let friends use IE"


                                                                                       
             
             [EMAIL PROTECTED]                                                         
        
                                                                                       
             
             09/15/04 06:28 AM                                                         
          To 
                                                 [EMAIL PROTECTED]                     
                
                                                                                       
          cc 
                                                 [EMAIL PROTECTED],                    
    
                                                 [EMAIL PROTECTED], [EMAIL PROTECTED]  
 
                                                                                       
     Subject 
                                                 Re: SQL question:  Find next unused 
number...      
                                                                                       
             
                                                                                       
             
                                                                                       
             
                                                                                       
             
                                                                                       
             
                                                                                       
             




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