A: 

Not sure if I am over simplyfing here but would it not be

SELECT CODE, COUNT(CODE), SUM(COUNT), YEAR(DATE), MONTH(DATE) FROM tbl GROUP BY CODE, COUNT, YEAR(DATE), MONTH(DATE)
uriDium
Err, yes this worked minus the group by count. Thank you very much... I knew it had something to do with group by but I couldn't figure it out!