select * from (select *,rownum rn from A ) where rn>=1 and rn<=10

jackeyhlj 2011-02-23 11:29:17
select * from (select *,rownum rn from A ) where rn>=1 and rn<=10
这样写有什么错
...全文
756 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sedd4444 2011-03-02
  • 打赏
  • 举报
回复
直接在Rownum >=1 and Rownum<=10 不就OK拉,你又没排序什么的
luoyoumou 2011-02-23
  • 打赏
  • 举报
回复
-- 要不就这样:(给表加个别名)
select rownum, e.* from emp e;
luoyoumou 2011-02-23
  • 打赏
  • 举报
回复
scott@SZTYORA> select *, rownum rn from emp;
select *, rownum rn from emp
*
第 1 行出现错误:
ORA-00923: 未找到要求的 FROM 关键字


-- 当指定 rownum时,其他字段,不能用*,必须一一列出!(楼主:别偷懒,好不?)
minitoy 2011-02-23
  • 打赏
  • 举报
回复
select * from (select a.*,rownum rn from A ) where rn>=1 and rn<=10

*号前加上表名
minitoy 2011-02-23
  • 打赏
  • 举报
回复
没错误
cuicuidonghua 2011-02-23
  • 打赏
  • 举报
回复
select * from (select t1.*,rownum rn from (select * from emp) t1 where rownum<=10) where rn>=1; 这条肯定没错咯
minitoy 2011-02-23
  • 打赏
  • 举报
回复
呵呵,没排序的分页语句是看着不爽[Quote=引用 7 楼 cuicuidonghua 的回复:]
怎么看这条分页语句。。。 怎么别扭。。。
[/Quote]
cuicuidonghua 2011-02-23
  • 打赏
  • 举报
回复
怎么看这条分页语句。。。 怎么别扭。。。
smzen 2011-02-23
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 minitoy 的回复:]


[/Quote]

同二楼
wht8008 2011-02-23
  • 打赏
  • 举报
回复
2L是最佳答案。

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧