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

Try this in Oracle:

select * from person
where (ID, rank) in
(select ID, max(rank) from person group by ID)
and rownum
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

請您先登陸,再發跟帖!