看板 Database 關於我們 聯絡資訊
我想你的問題可能是 查出 id,max(value)後要再找出這個資料的 date,note select b.* from( select id,max(value) as max_value from table group by id) a left join table b on a.id=b.id and a.max_value=b.valus 但一個id的max(value) join 到 B後可能會有兩筆上 (一個id有可能有2筆以上相同的最大值) ※ 引述《folus (folus)》之銘言: : 請教各位高手: : 我目前遇到一個問題,直接看 SQL 吧 : select id,max(value) from table group by id : table 欄位共有 id,value,date,note : 我要如何查詢相依於結果 id,max(value)的其他欄位呢? : 感謝高手協助 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.139.23.140