Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Select
- fin.lot_id,
- c.contractrnk,
- c.grbsname,
- c.customername,
- max(c.stagetitle)stagetitle,
- max(trunc(c.contractsigndate))contractsigndate,
- Sum(Case When type=2 Then finsum Else Null End) fact
- From dwh_contract_fin_kgntv fin
- Inner join dwh_contract_kgntv c on c.contractid=fin.contract And Extract(year From c.contractsigndate)=2024
- Group by fin.lot_id, c.contractrnk,c.grbsname,c.customername
- Having (Sum(Case When type=1 Then finsum Else Null End) - sum(Case When type=2 Then finsum Else Null End))<0;
- Select
- *
- From dwh_payments
- Where year=2024
- and rnk='2780504546224000004';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement