Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Select
- lot_id,
- sum(finsum)finsum,
- sum(finsum_f)finsum_f
- From(
- Select lot_id,
- finsum,
- finsum_f,
- -- Ограничение на квр 244, т.к. на 30.01.23 данный квр ТОЛЬКО у ЦС '0510057840'
- case
- when (tar.targetexpenseitemcode in ( select targetexpenseitemcode from dwh_targetexpenseitemcode_aip where year='2024' /*year*/) and tar.expensetypecode not in ('244')) -- !!!!!!!!!!!
- or (tar.targetexpenseitemcode='022E15305F' and tar.expensetypecode='414' and tar.kosgucode='310' and tar.contragent_account='0230004') -- правило по письму крицкой от 5.10.222
- or tar.aip_code is not null
- then 'Да' else 'Нет'
- end priznak_aip --Признак совпадения целевой статьи (АИП)
- From FIN_TARG_CON_2024_VIEW /*year*/ tar -- !!!!!!!!!!!
- )
- Where finsum is not null
- Group By lot_id
- -- , targetexpenseitemcode ,budget_type ,expensetypecode,kosgucode ,contragent_account ,tar.aip_code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement