日期:2014-05-17  浏览次数:20741 次

plsql 数据库操作问题求解
select
  TA_SHELFSEQ_T.GNDL_NUM,
  TA_SHELFSEQ_T.SHELF_NUM,
  TA_SHELFSEQ_T.SEQ_NUM,
  TA_SHELFSEQ_T.ITEM_CD,
 (ROW_NUMBER()OVER(PARTITION BY TA_SHELFSEQ_T.ITEM_CD ORDER BY TA_SHELFSEQ_T.SCAN_DATE DESC)) as tt
 from TA_SHELFSEQ_T
 我想获取排序后tt ='1'的值,如何写

就是 where tt ='1'这个条件如何写进去,直接写进去,不能运行




------解决方案--------------------
select 
* from (select
TA_SHELFSEQ_T.GNDL_NUM,
TA_SHELFSEQ_T.SHELF_NUM,
TA_SHELFSEQ_T.SEQ_NUM,
TA_SHELFSEQ_T.ITEM_CD,
 (ROW_NUMBER()OVER(PARTITION BY TA_SHELFSEQ_T.ITEM_CD ORDER BY TA_SHELFSEQ_T.SCAN_DATE DESC)) as tt
 from TA_SHELFSEQ_T)
where tt=1