小小梦想pxh

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

解决方案:使用row_number() over( partition by) 方法分组排序

    with temp as (
         select a,b,c from test_table
    )
     
    select a,b,c from (
           select a,b,c,row_number() over (partition by a order by rownum) row_no from temp
    ) where row_no = 1

ps:   with temp as() 括号内的内容 就是查询的sql 结果包含重复数据

posted on 2021-04-16 16:05  小小梦想pxh  阅读(141)  评论(0)    收藏  举报