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


and not exists (
    select 1
    from ourpension.year_tax_deduction td2
    where td2.number = td.number
      and td2.type != 'NONE'
      and (
          td2.year > td.year
          or (
              td2.year = td.year
              and td2.id > td.id
          )
      )
)