aboutsummaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/dawn.sql6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index a84355ed..1cb8e759 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -3592,15 +3592,15 @@ AS SELECT tranche_risk.date,
FROM tranche_risk
LEFT JOIN cds ON tranche_risk.tranche_id = cds.id
FULL JOIN ( SELECT
- citco_stax.trader_notes ,
+ COALESCE(citco_stax.trader_notes, citco_stax.fix_id) AS fix_id,
citco_stax.period_end_date,
0 AS admin_accrued,
sum(base_market_value) AS admin_clean_nav,
sum(-quantity) AS admin_notional
FROM citco_stax WHERE close_trade_date IS NULL
- GROUP BY citco_stax.trader_notes, citco_stax.period_end_date) a ON a.trader_notes= concat('SCCDS', tranche_risk.tranche_id) AND a.period_end_date = tranche_risk.date
+ GROUP BY COALESCE(citco_stax.trader_notes, citco_stax.fix_id), citco_stax.period_end_date) a ON a.fix_id= concat('SCCDS', tranche_risk.tranche_id) AND a.period_end_date = tranche_risk.date
LEFT JOIN index_version ON cds.security_id::text = index_version.redindexcode
LEFT JOIN external_marks_deriv ON cds.cpty_id = external_marks_deriv.identifier AND external_marks_deriv.date = tranche_risk.date
WHERE cds.fund = 'ISOSEL'::fund
ORDER BY index_version.index, index_version.series, cds.orig_attach;
- \ No newline at end of file
+ \ No newline at end of file