left join lateral (
select
coalesce(et.strategy_id, te.strategy_id) as strategy_id,
sum(t.value) as sumoper
from back_office.transaction t
left join back_office.transaction_extended te
on te.transaction_id = t.id
where t.operation_id = o.id
group by coalesce(et.strategy_id, te.strategy_id)
) tran on true