日期:2014-05-16  浏览次数:20616 次

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

001
002
003
997
998
999

------解决方案--------------------
获取该列的最大数字 建议重修你的汉语。

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

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