Discount Report SELECT discount, sum(amount) as amount from %%AGILE_DB_PREFIX%%invoice_item_discount A A.site_id = %%DEFAULT_SITE%% GROUP BY discount ORDER BY amount DESC SELECT discount,invoice_id, count(invoice_id) as sales, sum(amount) as amount from %%AGILE_DB_PREFIX%%invoice_item_discount A A.site_id = %%DEFAULT_SITE%% GROUP BY discount ORDER BY amount DESC 0 Discount Code discount true true Items Discounted sales true Discount Amount amount true dol,2 dol,2 SELECT from_unixtime(date_orig,"%Y") as yearmonth, sum(amount) as amount from %%AGILE_DB_PREFIX%%invoice_item_discount A A.site_id = %%DEFAULT_SITE%% GROUP BY yearmonth ORDER BY yearmonth DESC SELECT from_unixtime(date_orig,"%Y-%u") as yearmonth, sum(amount) as amount from %%AGILE_DB_PREFIX%%invoice_item_discount A A.site_id = %%DEFAULT_SITE%% GROUP BY yearmonth ORDER BY yearmonth ASC