General information
Category:
Coding, syntax & commands
Hello,
I have the following sql statement which is not working properly. It doubles up the total for the fields that I want to sum:
SELECT OUT.*,
SUM(IIF(RPT_YEAR = "1997",PL_TOT,000000)) AS P97,;
SUM(IIF(RPT_YEAR = "1997",CL_TOT,000000)) AS C97,;
SUM(IIF(RPT_YEAR = "1997",TOTAL,000000)) AS T97,;
SUM(IIF(RPT_YEAR = "1998",PL_TOT,000000)) AS P98,;
SUM(IIF(RPT_YEAR = "1998",CL_TOT,000000)) AS C98,;
SUM(IIF(RPT_YEAR = "1998",TOTAL,000000)) AS T98, ;
SUM(IIF(RPT_YEAR = "1999",PL_TOT,000000)) AS P99,;
SUM(IIF(RPT_YEAR = "1999",CL_TOT,000000)) AS C99,;
SUM(IIF(RPT_YEAR = "1999",TOTAL,000000)) AS T99 ;
FROM BROKPROD,OUT;
WHERE BROKPROD.AG_ID = OUT.AG_ID ;
GROUP BY BROKPROD.AG_ID ;
ORDER BY BROKPROD.AG_ID ;
INTO TABLE &OUTPUT
Can anyone tell me what I did wrong ??
thanks
sherry
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only