mysql:X表中A與B兩個欄位,想求以A分組之后,B欄位去除最大值之后的所有記錄,得如何實作?試過用連接和NOT EXISTS查詢不出資料,請大神幫忙,萬分感謝!
uj5u.com熱心網友回復:
select t3.* from X t3 where t3.id not in (select t2.id from (
select t1.* from X t1 order by t1.B desc
) t2 group by t2.A
)
uj5u.com熱心網友回復:
select * from X T where (T.A,T.B) not in (select A,max(B) from X group by A)uj5u.com熱心網友回復:
感謝樓上二位大神!轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/31660.html
標籤:MySQL
