mysql 查询 最大值,最小值,第二大,第三大 一共四个值

最大值: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

猜你喜欢

转载自www.cnblogs.com/meimei00/p/10558750.html
今日推荐