Interestingly enough, I am not new to the SQL programming language. I am new to the DB2 syntax. When I tried adding a simple sum() function on a field, I get errors. Here it is....(I am having a hard time understanding the error handling that the ISeries returns.)
[IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0122 - Column BPKQCD or expression in SELECT list not valid.
SQL = "SELECT BPKQCD as Unit, BPKRCD as Nature, sum(BSBEVA) as Budget, sum(BPBAVA/100) as Actual, BPGDNB, sum((BSBEVA-(BPBAVA/100)))as Variance, AHADNA FROM YABPREP LEFT OUTER JOIN YABSREP ON BPKQCD = BSJ6CD AND BPKRCD = BSJ7CD and BPGDNB=BSNBCD INNER JOIN YAAHREP ON BPKRCD = AHAFCD"