ORACLE 分组排序取每组的第一条记录

select BOOKMARK_ID,SCANED_TIME from (
  select BOOKMARK_ID, SCANED_TIME, row_number() over(partition by BOOKMARK_TYPE order by SCANED_TIME asc ) ST from SNSEC_BMARK_SCANED_BARCODE
  where BOOKMARK_TYPE IN('001','002') and CUSTOMER_ID =111111  and BOOKMARK_STATUS = 1

)  where ST =1

 

本文出自 “keeplearning” 博客,谢绝转载!

你可能感兴趣的:(oracle)