Advertisement
ariswb22

Untitled

Apr 25th, 2024
1,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.28 KB | None | 0 0
  1. SELECT
  2.     [COUNTER_PARTY_ID] AS 'counter_party_id'
  3.     ,HC.[SNAPSHOT_DATE] AS 'snapshot_date'
  4.     ,HC.[ENTITY] AS 'entity'
  5.     ,HC.[ORIGIN_CONTRACTID] AS 'origin_contractid'
  6.     ,HC.[ORIGIN_COUNTER_PARTYDID] AS 'origin_counter_partydid'
  7.     ,HC.[ORIGIN_SYSTEMID] AS 'origin_systemid'
  8.     ,[PRODUCT_TYPE] AS 'product_type'
  9.     ,[PRODUCT_SUBTYPE] AS 'product_subtype'
  10.     ,[BUSINESS_UNIT] AS 'business_unit'
  11.     ,[SEGMENT] AS 'segment'
  12.     ,HC.[CURRENCY] AS 'currency'
  13.     ,[MATURITY_DATE] AS 'maturity_date'
  14.     ,[OBSERVATION_DATE] AS 'observation_date'
  15.     ,[OUTSTANDING_AMT] AS 'outstanding_amt'
  16.     ,[COLLECTIBILITY] AS 'collectibility'
  17.     ,[DYS_PAST_DUE] AS 'dys_past_due'
  18.     ,[DISCOUNT_RATE]/100 AS 'discount_rate'
  19.     ,[DP_IND] AS 'dp_ind'
  20.     ,[CDD_IND] AS 'cdd_ind'
  21.     ,[IS_REPO] AS 'is_repo'
  22.     ,CASE WHEN [IS_REPO] = 1 THEN 'true' ELSE 'false' END AS 'is_defaulted'
  23.     ,HC.[FLAG_JF] AS 'flag_jf'
  24.     ,HC.[BANK_JF] AS 'bank_jf'
  25.     ,HR.[RECOVERY_AMT] AS 'recovery_amt'
  26.     ,HR.[RECOVERY_DATE] AS 'recovery_date'
  27. FROM [PSAK71_STG].[dbo].[PSAK_HISTORICAL_CONTRACT] HC
  28. LEFT JOIN [PSAK71_STG].[dbo].[PSAK_HISTORICAL_RECOVERIES] HR
  29. ON HC.[ORIGIN_CONTRACTID] = HR.[ORIGIN_CONTRACTID] AND HC.[SNAPSHOT_DATE] = HR.[SNAPSHOT_DATE]
  30. WHERE 1=1
  31.     AND HC.[SNAPSHOT_DATE] = @ReportingDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement