Thanks Rabbit, I ended up using CASE nested in my SUM line from the select statement. My Transaction Codes are acutally numbers, so my syntax looks like this:
SELECT
ABCHRG,
SUM ( CASE
WHEN TCODE IN ( 100, 101, 102, 103, 104, 105, 106, 107, 200, 201, 202, 203, 204, 250, 251, 252, 253, 300, 301, 302, 303, 400, 401, 402, 403, 450, 451, 452, 453, 475, 476, 477, 478, 900, 901, 902, 903, 904, 905, 906 ) THEN...
User Profile
Collapse
-
daremo18 started a topic How can I get totals of fields from multiple rows, based upon the value of the field?in DB2How can I get totals of fields from multiple rows, based upon the value of the field?
I have a table, like this:
PatNo TranCde TranAmt
1000 Adj1 -250
1000 Adj2 -100
1000 Pmt1 300
1000 Pmt2 700
2000 Adj1 -450
2000 Adj2 -75
I need to total all Adjustments as a result, but in the same query total all Payments. Not all patients will...
No activity results to display
Show More
Leave a comment: