sql一个字段每种不同类型各取前三条

要 id为188的前三条和id189的前三条 下面还有 每种都有前三条 要 oracle的代码 谢谢
最新回答
且奔赴

2024-11-06 13:38:55

select a.* from
(select row_number()over(partition by id order by 排序字段) as num,*
from [table] )a where num<=3

请采纳,谢谢

追问
[SQL]select a.* from
(select row_number()over(partition by MENU_PARENTID order by MENU_PARENTID) as num,*
from DL_MENU )a where num<=3
[Err] ORA-00936: missing expression
追答
select a.* from
(select row_number()over(partition by menu_parentid order by menu_parentid) as num,t.*
from DL_MENU t)a where num<=3