回複:聽說這裏有很多sql高手,有個簡單問題請教

來源: CaLoanAgent 2009-03-16 18:59:34 [] [博客] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (299 bytes)
Try this in Oracle:

select * from person
where (ID, rank) in
(select ID, max(rank) from person group by ID)
and rownum<=1

But it's not random. Everytime when you select, the result should be the same.

You may need to add something "Randomly" select the row.

所有跟帖: 

Thank you! -fafa_dd- 給 fafa_dd 發送悄悄話 (0 bytes) () 03/16/2009 postreply 19:24:06

我本來是想用self join的,但我對這個不熟,總搞錯 -fafa_dd- 給 fafa_dd 發送悄悄話 (0 bytes) () 03/16/2009 postreply 19:34:01

請您先登陸,再發跟帖!

發現Adblock插件

如要繼續瀏覽
請支持本站 請務必在本站關閉/移除任何Adblock

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

安裝Adblock plus用戶請點擊瀏覽器圖標
選擇“Disable on www.wenxuecity.com”

安裝Adblock用戶請點擊圖標
選擇“don't run on pages on this domain”