mysql 判断最大值,最小值,第二大,第三大 一共四个值

yjp309573588 1年前 已收到1个回答 举报

魔幻灯心 幼苗

共回答了15个问题采纳率:93.3% 举报

最大值:select max(num) from table
第二大值: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

1年前

6
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 1.454 s. - webmaster@yulucn.com