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


            sum(case
                when rd.account in ('38302', '38902')
                 and rd.contract_class_code = 'INS'
                 and rd.contract_model_label = 'VFA'
                 and (
                     rd.sum_dt_bu is not null
                     or rd.sum_ct_bu is not null
                 )
                then abs(
                    coalesce(rd.sum_dt_bu, 0)
                    - coalesce(rd.sum_ct_bu, 0)
                )
            end) as svfa_bu,

            sum(case
                when rd.account in ('38302', '38902')
                 and rd.contract_class_code = 'INS'
                 and rd.contract_model_label = 'BBA'
                 and (
                     rd.sum_dt_bu is not null
                     or rd.sum_ct_bu is not null
                 )
                then abs(
                    coalesce(rd.sum_dt_bu, 0)
                    - coalesce(rd.sum_ct_bu, 0)
                )
            end) as ВВА_bu,