mysql> select userid+1 from dyt_member t1 where not exists (select userid from dyt_member t2 where t2.userid=t1.userid+1) and length(userid)>5 order by userid limit 1;