项目中用到的sql

  今日推荐:

SELECT NT2.NEWS_ID,NT2.NEWS_TITLE,NT2.NEWS_URL,NT2.SYSTEM_COLUMN_ID,NT2.NEWS_DATE,NT2.RECOMMEND_CNT,SCC.SYS_COLUMN_NAME
        FROM (
  SELECT NT.NEWS_ID,NT.NEWS_TITLE,NT.NEWS_URL,NT.SYSTEM_COLUMN_ID,NT.NEWS_DATE,NT.RECOMMEND_CNT,
         row_number() OVER (PARTITION BY NT.SYSTEM_COLUMN_ID ORDER BY TRUNC(NT.NEWS_DATE) DESC,NT.RECOMMEND_CNT DESC) AS NEWSNUM
         FROM NEWS_TAB NT  WHERE NT.MONTH = TO_NUMBER(TO_CHAR(SYSDATE, 'MM'))  
         ) NT2,SYSTEM_COLUMN_CFG SCC WHERE NT2.NEWSNUM=1 AND NT2.SYSTEM_COLUMN_ID=SCC.SYS_COLUMN_ID
 

 

你可能感兴趣的:(sql)