读书人

sql语句多谢

发布时间: 2012-02-20 21:18:25 作者: rapoo

求一个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

读书人网 >Mysql

热点推荐