oracle排序后取前几条

今天写了一个oracle的语句:(以前没用过oracle)
语句A:
select w.* from tbl_Win_List w,tbl_Game_Issue g,tbl_Game m where g.game_id=m.id and g.id=w.issue_id and m.gameid=3 and g.id=(select min(p.id) from (select e.id from tbl_Game_Issue e,tbl_Game a,tbl_Win_List i where e.game_id=a.id and i.issue_id=e.id and gameid=3 and rownum<=2 order by e.id desc) p)

语句B:
select w.* from tbl_Win_List w,tbl_Game_Issue g,tbl_Game m where g.game_id=m.id and g.id=w.issue_id and m.gameid=3 and g.id=(select min(p.id) from (select id from (select e.id from tbl_Game_Issue e,tbl_Game a,tbl_Win_List i where e.game_id=a.id and i.issue_id=e.id and gameid=3 order by e.id desc) where rownum<=2) p)

如果这样取的话A语句是先取限定条数后排序,语句B是先排序后取条数,根据要求B语句是正确的写法

你可能感兴趣的:(oracle)