原 postgresql分组后只取其中一条数据
版权声明:本文为博主原创文章,请尊重他人的劳动成果,转载请附上原文出处链接和本声明。
本文链接:https://www.91mszl.com/zhangwuji/article/details/1477
select * from (
select
p.pmi_code, row_number() over (partition by p.pmi_code order by p.build_date desc) as rowId
from res_aa p
where p.customer_code='kk' and p.project_type='t'
order by p.build_date desc
) t where t.rowId=1
2024-02-06 16:49:47 阅读(290)
名师出品,必属精品 https://www.91mszl.com
博主信息