有这样一组数据,我想获取该列的最大数字,注意是003而不是999,因为中间有一部分数字没有被利用,我想利用起来,请问这样的sql语句怎么写啊,谢谢001
002
003
997
998
999

解决方案 »

  1.   

    获取该列的最大数字 建议重修你的汉语。select min(col) from xxx where col+1 not in (select col from xxx)
      

  2.   

    SELECT min(a.id) from tt5 a left join tt5 b on 0+a.id=0+b.id-1 where b.id is null
      

  3.   

    select min(col) from xxx where col+1 not in (select col from xxx)