Yearly Sales by SKU heading select from_unixtime(A.date_orig,'%Y') as year, A.sku, B.account_id from %%AGILE_DB_PREFIX%%invoice_item A inner JOIN %%AGILE_DB_PREFIX%%invoice B ON (A.invoice_id=B.id and billing_status=1 and (refund_status=0 or refund_status is null) and B.site_id=%%DEFAULT_SITE%%) A.site_id = %%DEFAULT_SITE%% GROUP BY year ORDER BY year DESC 0 Breakdown for Year: year true true true false false Account B.account_id false SKU sku false select A.sku, sum(A.quantity) as quan, sum(A.total_amt) as amt, from_unixtime(A.date_orig,'%Y') as year, B.account_id from %%AGILE_DB_PREFIX%%invoice_item A inner JOIN %%AGILE_DB_PREFIX%%invoice B ON (A.invoice_id=B.id and billing_status=1 and (refund_status=0 or refund_status is null) and B.site_id=%%DEFAULT_SITE%%) A.site_id = %%DEFAULT_SITE%% GROUP BY year, sku ORDER BY amt DESC 30 year false false SKU sku Quantity quan true num,0 num,0 Amount amt dol,2 true dol,2 select A.sku, sum(A.total_amt) as amt, from_unixtime(A.date_orig,'%Y') as year, B.account_id from %%AGILE_DB_PREFIX%%invoice_item A inner JOIN %%AGILE_DB_PREFIX%%invoice B ON (A.invoice_id=B.id and billing_status=1 and (refund_status=0 or refund_status is null) and B.site_id=%%DEFAULT_SITE%%) A.site_id = %%DEFAULT_SITE%% GROUP BY year, sku ORDER BY amt DESC