1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| TRANSFORM SUM(POSITION.curr_balance)
SELECT POSITION.Id_loan, LOAN.LXID, LOAN.Asset_name, LOAN.Issuer, PRICE.market_price, PRICE.Bid_markit, PRICE.Offer_markit, RATIN.DEFAULTED, RATIN.DEFAULTED_DATE
FROM (((
POSITION INNER JOIN Date_MAJ_POSITION AS d ON POSITION.mis_jour_date=d.laDate)
LEFT JOIN LOAN ON POSITION.Id_loan=LOAN.Id_loan)
LEFT JOIN PRICE ON POSITION.Id_loan=PRICE.Id_loan)
LEFT JOIN RATIN ON POSITION.Id_loan=RATIN.Id_loan
WHERE PRICE.Price_date = (SELECT MIN(i2.price_date) FROM PRICE i2 WHERE i2.Id_Loan = POSITION.Id_Loan AND i2.price_date >= POSITION.[mis_jour_date])
AND RATIN.rating_date = (SELECT MIN(i3.rating_date) FROM RATIN i3 WHERE i3.Id_Loan = POSITION.Id_Loan AND i3.rating_date >= POSITION.[mis_jour_date])
GROUP BY POSITION.Id_loan, LOAN.LXID, LOAN.Asset_name, LOAN.Issuer, PRICE.market_price, PRICE.Bid_markit, PRICE.Offer_markit, RATIN.DEFAULTED, RATIN.DEFAULTED_DATE
PIVOT POSITION.Id_CDO; |
Partager