討論串[SQL ]MAX()其他相依的欄位資料
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓1(1推 0噓 3→)留言4則,0人參與, 最新作者folus (folus)時間11年前 (2013/03/25 16:14), 編輯資訊
2
0
0
內容預覽:
請教各位高手:. 我目前遇到一個問題,直接看 SQL 吧. select id,max(value) from table group by id. table 欄位共有 id,value,date,note. 我要如何查詢相依於結果 id,max(value)的其他欄位呢?. 感謝高手協助. --

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者twyes1688 (twyes1688)時間11年前 (2013/03/27 10:57), 編輯資訊
0
0
0
內容預覽:
我想你的問題可能是. 查出 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. o

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者cdanyu (炸炸炸~彈)時間11年前 (2013/04/21 22:21), 編輯資訊
0
0
0
內容預覽:
oracle 的語法可以參考,. 不知道是不是你要的結果!. select id, value, date, note. from table. where id || value in (. select id || max(value). from table. group by id. ).
首頁
上一頁
1
下一頁
尾頁