FIRST_VALUE

来源:互联网 发布:3d电子相册软件下载 编辑:程序博客网 时间:2024/04/29 11:18

select *
  from (select kk.nm_info_id,
               kk.st_info_title,
               tt.nm_attach_id,
               attach.st_attach_title
          from pb_information kk
          left join (select distinct (FIRST_VALUE(t.nm_info_attach_id)
                                     OVER(PARTITION BY i.nm_info_id ORDER BY
                                          t.dt_input desc)) as nm_attach_id,
                                    i.nm_info_id
                      from pb_info_attach t
                      left join pb_information i on i.nm_info_id = t.nm_info_id
                     where t.st_attach_type = '.jpg'
                       and i.st_is_handin = '3'
                       and i.st_del_flag = '0') tt on kk.nm_info_id = tt.nm_info_id
         inner join pb_info_attach attach on attach.nm_info_attach_id = tt.nm_attach_id
         order by kk.dt_deploy_date desc)
 where rownum <= 8

原创粉丝点击