1. 程式人生 > >mysql 查詢 最大值,最小值,第二大,第三大 一共四個值

mysql 查詢 最大值,最小值,第二大,第三大 一共四個值

ble dao from tps HERE not in amp www targe

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

mysql 查詢 最大值,最小值,第二大,第三大 一共四個值