回复:听说这里有很多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.