第二大值:select max(num) from table
where num not in(select max(num) from table)
第三大值:select max(num) from table
where num not in(select max(num) from table
where num not in(select max(num) from table))
最小值:select min(num) from table
select * from table order by id limit 1,1//先按 id 从小到大倒叙排列,然后从第二条开始取数据,只取一条,那么取出的这一条数据 id 就是倒数第二大的
//limit m,n;第一个参数 m 表示从第几条开始取数据,m 从 0 开始,依次为第一条、第二条。。。,第二个参数 n 表示要取出多少条数据
$sql="select*
from
$c1"
$result
=
mysql_query($sql)
or
die
(mysql_error())
$sums=mysql_num_fields($result)
//
这个这是字段的总个数
如果对您有帮助,请记得采纳为满意答案,谢谢!祝您生活愉快!
vaela
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)