Advertisement
GLASHATAY_007

Untitled

Mar 29th, 2024
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Select
  2. fin.lot_id,
  3. c.contractrnk,
  4. c.grbsname,
  5. c.customername,
  6. max(c.stagetitle)stagetitle,
  7. max(trunc(c.contractsigndate))contractsigndate,
  8. Sum(Case When type=2 Then finsum Else Null End) fact
  9. From dwh_contract_fin_kgntv fin
  10. Inner join dwh_contract_kgntv c on c.contractid=fin.contract And Extract(year From c.contractsigndate)=2024
  11. Group by fin.lot_id, c.contractrnk,c.grbsname,c.customername
  12. Having (Sum(Case When type=1 Then finsum Else Null End) - sum(Case When type=2 Then finsum Else Null End))<0;
  13.  
  14.  
  15. Select
  16. *
  17. From dwh_payments
  18. Where year=2024
  19. and rnk='2780504546224000004';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement