![]() |
|
Archives of the TeradataForumMessage Posted: Fri, 24 Jan 2014 @ 10:57:34 GMT
Hi Experts,
Input Table 1 Input Table 2
============== ==============
ID1 ID2 ID Balance
-------------- -------------
1001 1002 1001 10
1001 1003 1002 20
1001 1004 1003 500
2002 1004 1004 40
2002 1005 1005 550
2002 1006 1006 60
2003 1006 1007 70
2003 1007 1008 100
2003 1008 1009 80
2004 1008 1010 100
2004 1011 1011 200
1022 1009 1012 200
1010 1015 1015 300
1010 1012 1022 400
2002 500
2003 800
2004 250
Output Table
============
CUSTOMER BALANCE
---------------------
1001 1350
1002 1350
1003 1350
1004 1350
1005 1350
1006 1350
1007 1350
1008 1350
1009 480
1010 600
1011 1350
1012 600
1015 600
1022 480
2002 1350
2003 1350
2004 1350
1) Since the IDs 1001,1002,1003,1004,1005,1006,1007,1008,2002,2003,2004,1011 are linked their sums are aggregated to 1350 2) Similarly IDs like 1010,1012,1015 are linked, their sums are aggregated to 600 3) Similarly IDs like 1022,1009 are linked together their sums are aggregated to 480 Thanks Mohankumar
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||