unfortunately taht query did not encompass all scenarios such as:
col1 col2 col3
('A','B',100),
('B','A',-50),
('A','C',200),
('A','D',100),
('A','B',150),
('B','F',200),
('d','K',400),
('K','D',-20),
('C','D',-50),
('D','C',-60);
I need to display which one of col1 or col2 had the max net value (col3). I mean I have to have as a result:
A,B,300
A,C,200
A,D,100
B,F,200
D,K,420
C,D,10
hopefully this table will help to cover all 4 scenarios of values between col1 and col2 (first two rows). Last four rows is the answer we need to get:
A | B | 30 | 30 | -30 | -30 |
B | A | 90 | -90 | 90 | -90 |
B | A | 60 | |||
A | B | 120 | |||
B | A | 120 | |||
A | B | 60 |
s???9w