|
|
Archives of the TeradataForum
Message Posted: Sat, 01 Oct 2011 @ 14:23:10 GMT
Subj: | | Re: Need a help in the logic of query |
|
From: | | DUELL, BOB |
Hard to tell, but this might work:
SELECT T0300.Acc_No as DealId
, a.Acc_No as Portfolio
, b.Acc_No as Instrument
FROM T300_AGREEGEMENT T300
INNER JOIN T309_ACC_ACC_RELATIONSHIP a
ON T300.Acc_No = a.Related_Acc_No
AND T300.Acc_Modifier_No = a.Related_Acc_Modifier_No
AND a.Acc_Relationship_Type_Cd = 'Part_Deal'
INNER JOIN T309_ACC_ACC_RELATIONSHIP b
ON T300.Acc_No = a.Related_Acc_No
AND T300.Acc_Modifier_No = b.Related_Acc_Modifier_No
AND b.Acc_Relationship_Type_Cd = 'Scrty_Of'
ORDER BY 1 DESC
| |