yzh14249040
yzh14249040
采纳率0%
2016-07-22 07:43 阅读 1.9k

SQL语句中rownum的问题!

                        select distinct cp.*,ai.*  from ACCESSORY_INFO ai
                        RIGHT JOIN CHASE_PEOPLE cp ON AI.BAND_ID = cp.OBJ_ID
                        left join CHASE_CASE_INFO ci on cp.OBJ_ID = ci.CASE_PEOPLE_ID 
                        where 1=1  
                        and cp.CHASE_APPLY_STATUS in 2 and cp.CHASE_STATUS in 2
                        ORDER BY cp.CREATE_DATE DESC
        此时,查询语句可以正常查询到数据。

                        select * from
                    (
                        select distinct cp.*,ai.*  from ACCESSORY_INFO ai
                        RIGHT JOIN CHASE_PEOPLE cp ON AI.BAND_ID = cp.OBJ_ID
                        left join CHASE_CASE_INFO ci on cp.OBJ_ID = ci.CASE_PEOPLE_ID 
                        where 1=1  
                        and cp.CHASE_APPLY_STATUS in 2 and cp.CHASE_STATUS in 2
                        ORDER BY cp.CREATE_DATE DESC
                ) 
                where ROWNUM < 10;

                加上ROWNUM < 10;之后,会报[Err] ORA-00918: 未明确定义列错误,是什么原因呢?,语句看起来没问题啊?
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • sdsfdsffsd sdsfdsffsd 2016-07-22 07:51

    你在子查询里都没有显示rownum,所以就报错啊,select distinct cp.*,ai.*,rownumber from ACCESSORY_INFO

    点赞 评论 复制链接分享
  • monon2 monon2 2016-07-22 07:51

    ROWNUM 未定義

    点赞 评论 复制链接分享
  • lg_longer lg_longer 2016-07-22 08:28

    和rownum没关系, ,明显你 cp.*,ai.* 里面有重复字段

    点赞 评论 复制链接分享
  • baidu_34046383 星之火燎原 2016-07-22 09:23

    之前没有定义rownum

    点赞 评论 复制链接分享

相关推荐