New user. Tyring to figure out how to group two statements

Database

New user. Tyring to figure out how to group two statements

For some reason I cannot figure out how to group these two statements.  I want the values of trxn_dt to match up with a.debt_mgr_rtr_acct_num.  I have included the code below and if anyone could help with this, I would greatly appreciate it!  Fist time post with code snippet, so any recommendations in posting would help as well.

sel   a.DEBT_MGR_RTR_ACCT_NUM, a.PLCMT_STRT_DT , a.PLCMT_END_DT , AGT_AGY_CD , CATG_CD

from prdm.rcvry_acct_agy_plcmt a

left join prdm.rcvry_agy_work_que_vw c
on a.agy_work_que_id = c.agy_work_que_id

left join prdm.RCVRY_ACCT_ACTVY_NOTE b
on a.debt_mgr_rtr_acct_num = b.debt_mgr_rtr_acct_num
and actvy_dt between a.plcmt_strt_dt and coalesce(a.plcmt_end_dt, date)
and a.DEBT_MGR_RTR_ACCT_NUM = b.DEBT_MGR_RTR_ACCT_NUM

left join prdm.RCVRY_ACCT_PMT_TRXN x
on a.debt_mgr_rtr_acct_num = x.debt_mgr_rtr_acct_num

where agt_agy_cd in
('AGENT1','AGENT2','AGENT3')

and a.plcmt_end_dt is null

/*date conditional*/

and a.plcmt_strt_dt = date - 22

/*end date conditional*/

and CATG_CD not IN ('AC', 'AB', 'AT', 'LK', 'SI', 'JK');

select DEBT_MGR_RTR_ACCT_NUM, max (trxn_dt) as Lst_PMT
from prdm.RCVRY_ACCT_PMT_TRXN

GROUP BY debt_mgr_rtr_acct_num

1 REPLY
Teradata Employee

Re: New user. Tyring to figure out how to group two statements

Duplicate post.