Here's a 'One-pass' method
Note: I had to do this on SQLServer and I think you need a & rather than a + to concat string fields in Oracle.
Code:SELECT DEPT ,SUM(AMOUNT) FROM DK_TEST WHERE CAST(CAST(MYYEAR AS CHAR(4))+ CAST([WEEK] AS CHAR(2))AS INT) BETWEEN 200512 AND 200601 GROUP BY DEPT




Reply With Quote