I am trying to run an update statement in Queryman with a subquery (listed below):
I am getting a syntax error "expected something between '(' and the 'sel' keyword".
Any ideas how to re-write it ?
update OLAPV2_DB.TO_L59_SUSP_BAL_AMT
set balance_amt =
(sel
balance_amt
from
pmdbivm_prd.coll_balance_hist
where
acct_id = OLAPV2_DB.TO_L59_SUSP_BAL_AMT.acct_id
and
(acct_id, eff_dt)
in (sel y.acct_id, min(y.eff_dt)
from pmdbivm_prd.coll_balance_hist y,
OLAPV2_DB.TO_L59_SUSP_BAL_AMT z
where
y.acct_id = z.acct_id
and z.eff_dt >= y.max_l59_susp_dt
group by 1)
and OLAPV2_DB.TO_L59_SUSP_BAL_AMT.balance_amt is null
)
;