whoops Or even
select count(product) numPol, product, sum(Cast((order_total/100.00) As Decimal(12,2))) txnSale, CASE WHEN agentcode = '12345' THEN agentCode ELSE '66666' End AS Agent from vs
where year(txndatetime) = 2004
group by product, CASE WHEN...