oracle rownum 问题请教

songxiaolin1831 2007-12-19 02:45:38
请帮忙看下为什么下列两个sql语句的志向结果是一样的

Select * From BizResources_Base a, (Select ResourcesGuid,ROWNUM As OracleRownum From
(Select ResourcesGuid From BizResources_Base Where 1=1 Order By CreateTime asc) Where ROWNUM <= 180) b
Where a.ResourcesGuid=b.ResourcesGuid And b.OracleRownum >= 161 And b.OracleRownum <= 180

Select * From BizResources_Base a, (Select ResourcesGuid,ROWNUM As OracleRownum From (Select ResourcesGuid From BizResources_Base Where 1=1 Order By CreateTime asc)Where ROWNUM <= 200) b Where a.ResourcesGuid=b.ResourcesGuid And b.OracleRownum >= 181 And b.OracleRownum <= 200
...全文
63 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
popeye627 2007-12-20
  • 打赏
  • 举报
回复
看看是不是資料問題 或者 是不是关联的时候主key不全
我试了下你的SQL,OK呀,161~180 181~200
songxiaolin1831 2007-12-20
  • 打赏
  • 举报
回复
ResourcesGuid是主键阿
anyoneking 2007-12-19
  • 打赏
  • 举报
回复
你的ResourcesGuid是主键吗?或者是唯一属性吗?如果不是的话,是否应该在子查询中加入distinct
Select distinct ResourcesGuid From BizResources_Base
如果其确实是唯一的,就不知道原因了。

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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