Last Updated: February 25, 2016
·
661
· xt84

Number seq generate in SQL

select
    newcode+step
from
    (select max(code) as newcode from cpncode) c,
    (select count(*) as step 
 from cpncode a, cpncode b 
 where 
    a.code <= b.code 
group by a.code limit 5) d;