霍夫曼降解中间体:如何在数据库中用select找到最大值所在的记录
来源:百度文库 编辑:高考问答 时间:2024/04/29 01:24:42
比如我知道要找到特定值所在的记录用下面语句
jilu="select * from biao where num=13"
可是,我要找num字段里最大值所在的记录行,该怎么写?
jilu="select * from biao where num=13"
可是,我要找num字段里最大值所在的记录行,该怎么写?
也可以这样:jilu="select top 1 * from biao order by num desc"
用MAX(num)这个函数就行了。
select * from 表 where num = select max(num)from 表
用top排序法,楼上那说的是取最大值,估计都没有试过~~还是经理级别,误导别人。
select top 1 * from biao order by num desc