Загрузка данных


select
    sum(t.value) as deposit_value
from back_office.transaction t
join back_office.operation o
    on o.id = t.operation_id
join back_office.operation_type ot
    on ot.id = o.operation_type_id
join back_office.account ca
    on ca.id = t.credit_account_id
join back_office.account_type cat
    on cat.id = ca.account_type_id
join back_office.account_type_group catg
    on catg.id = cat.account_type_group_id
join ourpension.sharer s
    on s.id = ca.owner_sharer_id
where s.number = 'ТКС-1052880'
    and catg.mnemonics = 'Н'
    and ot.code = 'DEPOSIT_ENROLLMENT'
    and o.approved is not null
    and o.deleted is null
    and t.effective_date < cast('2026-10-20' as date);