第一個查詢如何結合以下查詢導致MySQL的
select b.id , b.value,b.name from table_1 b where b.id = 900;
結果:
id value name
900 5027 AA
900 79426 BB
900 132276 CC
900 302885 DD
第二個查詢
select a.id , max(a.value) from table_1 a where a.id = 900 group by a.id ;
結果
id value
900 302885
現在,我要像
id value name
900 302885 DD
在此先感謝...可以手工錄入The Rows Holding the Group-wise Maximum of a Certain Column發現的怎麼辦呢
此查詢爲我提供所有列 – PSR
@PSR確定沒有複製和粘貼錯誤?試用一個sqlfiddle(見更新的答案)。完美地爲我工作,我可以看到沒有錯誤。 – fancyPants
對不起。這是我的錯誤 – PSR