aboutsummaryrefslogtreecommitdiffstats
path: root/sql/et_tables.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/et_tables.sql')
-rw-r--r--sql/et_tables.sql11
1 files changed, 5 insertions, 6 deletions
diff --git a/sql/et_tables.sql b/sql/et_tables.sql
index b039edb5..5e9499d2 100644
--- a/sql/et_tables.sql
+++ b/sql/et_tables.sql
@@ -391,15 +391,14 @@ CREATE OR REPLACE VIEW latest_clo_universe AS
GRANT ALL ON latest_clo_universe TO et_user;
CREATE OR REPLACE VIEW latest_cusip_universe AS
- WITH latest_cusip_update AS
- (SELECT DISTINCT ON (cusip_id) * FROM cusip_update
- ORDER BY cusip_id, updatedate DESC)
- SELECT a.cusip, a.isin, a.bloomberg_ticker, a.dealname,
+SELECT DISTINCT ON (cusip_id) a.cusip, a.isin, a.bloomberg_ticker, a.dealname,
a.tranche, a.paripassu_tranches, a.orig_balance, a.orig_moody,
a.orig_attach, a.orig_detach, a.floater_index, a.spread,
a.type, b.curr_balance, b.coupon, b.curr_moody, b.curr_attach,
- b.curr_detach, b.updatedate FROM cusip_ref a
- JOIN latest_cusip_update b USING (cusip_id);
+ b.curr_detach, b.updatedate from cusip_update b JOIN cusip_ref a USING (cusip_id)
+ JOIN deal_indicative USING (dealname)
+WHERE paid_down IS NULL ORDER BY cusip_id, updatedate DESC;
+
CREATE OR REPLACE FUNCTION historical_clo_universe(p_dealname varchar(10), p_date date)
RETURNS SETOF latest_clo_universe AS $$