Oracle Query 问题

luxury515 发布于 2016/01/18 13:16
阅读 66
收藏 0

SELECT RNUM,
       TOTALNO,
       TF.FAQ_NUM,
       FAQ_CATE_NUM,
       (SELECT CATE_NM FROM T_FAQ_CATE WHERE FAQ_CATE_NUM = TF.FAQ_CATE_NUM) CAET_NAME,
       TITLE,
       NVL(UV,0) UV,
       NVL(PV,0) PV,
       (SELECT ID
          FROM T_ADMIN
         WHERE TF.IN_NUM = A_NUM)
          INNM,
       (SELECT ID
          FROM T_ADMIN
         WHERE TF.UP_NUM = A_NUM)
          UPNM,
       IN_DAY,
       UP_DAY
FROM (SELECT ROW_NUMBER () OVER (ORDER BY IN_DT DESC) AS RNUM,
               COUNT (*) OVER () AS TOTALNO,
               FAQ_CATE_NUM,
               FAQ_NUM,
               TITLE,
               IN_NUM,
               UP_NUM,
               TO_CHAR (IN_DT, 'YYYY-MM-DD HH24:MI') IN_DAY,
               TO_CHAR (UP_DT, 'YYYY-MM-DD HH24:MI') UP_DAY
       FROM T_FAQ) TF,
      (SELECT COUNT(DISTINCT(FAQ_NUM)) AS UV,
          COUNT(IN_NUM) AS PV,
          FAQ_NUM 
       FROM T_FAQ_VIEW
       GROUP BY (FAQ_NUM)) TFV   
WHERE  TF.FAQ_NUM = TFV.FAQ_NUM(+)
       AND RNUM > TOTALNO - (TOTALNO - (10 * (1 - 1)))
       AND RNUM <= TOTALNO - (TOTALNO - (10 * (1 - 1))) + 10;



RNUM 为什么不能排序 ? DESC , ASC , 在哪里添加???

帮我一下,谢谢



加载中
0
l
luxury515

最后自己加一行,解决了。


ORDER BY RNUM ASC

返回顶部
顶部