首页 > 数据库 >PGSQL去重取最新

PGSQL去重取最新

时间:2023-01-09 18:31:47浏览次数:40  
标签:01 num update PGSQL 最新 tm indicators select 重取

select a.*
,to_date(to_char(a.update_tm,'YYYY-01-01'),'YYYY-01-01') as 年份
from
(select department,name,indicators_num,occurrences_num,update_tm,(select max(write_date) from plan_repair_operational_indicators_info) as max_date from plan_repair_operational_indicators_info group by department,name,indicators_num,occurrences_num,update_tm ORDER BY department)
as a where a.update_tm=(select max(update_tm) from plan_repair_operational_indicators_info)

标签:01,num,update,PGSQL,最新,tm,indicators,select,重取
From: https://blog.51cto.com/u_14650780/5998686

相关文章