Viewing 10 posts - 1 through 10 (of 10 total)
Drew thank you very much for your help. Really apreciated. I just had to test all the possible data scenarios. My real table has more than 160 million records. However...
December 21, 2017 at 7:34 am
my apologies for the name confusion J. Drew.
December 20, 2017 at 10:39 am
I will check that part Jeff. I was checking all the possible scenarios and I think the query does not work for the following set of data:
create table VALUATION...
December 20, 2017 at 10:28 am
Awesome Jeff!!. Thanks a lot. I think the following query is also rdbms agnostic:
with newtab (col1,col2, mtm)
as
(SELECT upper(col1), upper(col2), mtm FROM sampledata
WHERE upper(col1) <...
December 20, 2017 at 7:34 am
Really sorry but business keep changing the requirements. My table is:
create table SampleData ( col1 VARCHAR(10), col2 VARCHAR(10), MTM numeric(10));
INSERT INTO SampleData VALUES
('A','B',100),
('B','A',-50),
('A','C',200),
('A','D',100),
('A','B',150),
December 19, 2017 at 8:39 am
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...
December 18, 2017 at 1:26 pm
Following query produced the expected results:
A B 300
A C 200
A D 100
B F 200
D C 50
SELECT CASE WHEN COL1 <= COL2 AND COL3 > 0 THEN COL1 ELSE COL2 END AS COL1,
CASE...
November 20, 2017 at 12:53 pm
Sorry . that was only half of the work I had to do. tuens out that every time I have negative value in col3 I have to turn col3 positive...
November 20, 2017 at 11:02 am
That is excellent guys. Both queries work as expected. I have modified the query a little bit to accomodate a case when col3 is negative. In that case it means...
November 20, 2017 at 9:11 am
col1 and col2 represent company names and col3 is the transaction value, could be negative, between the companies. So I want to know how much company A spent?
November 17, 2017 at 1:56 pm
Viewing 10 posts - 1 through 10 (of 10 total)