从下面的查询中,我想找到每个 request_id 的最后一个 activity_dt 的事件。我已经为此工作了几个小时,但无济于事。任何人都可以帮忙吗?
select a.event as event, a.activity_dt as activity_dt, b.request_id as request_id
from gs_pr_obl_event a, gs_pr_obl b
where a.obligation_id = b.obligation_id
union all
select event as event, activity_dt as activity_dt, request_id as request_id
from gs_pr_req_event;