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

來源: 2009-03-16 18:59:34 [博客] [舊帖] [給我悄悄話] 本文已被閱讀:

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.