Industry heading SELECT DISTINCT from_unixtime(date_orig,"%Y") as yearmonth from %%AGILE_DB_PREFIX%%account A A.site_id=%%DEFAULT_SITE%% ORDER BY yearmonth ASC 0 Year: yearmonth true true true false false SELECT DISTINCT UCASE(A.value) as value, count(A.id) as quan, sum(C.total_amt) as amt, from_unixtime(B.date_orig,'%Y') as yearmonth from %%AGILE_DB_PREFIX%%static_var_record A INNER JOIN %%AGILE_DB_PREFIX%%account B ON ( B.site_id = %%DEFAULT_SITE%% AND A.record_id=B.id AND A.static_var_relation_id=5 ) LEFT JOIN %%AGILE_DB_PREFIX%%invoice C ON ( C.site_id = %%DEFAULT_SITE%% AND C.account_id=A.record_id AND C.billing_status=1 AND C.process_status=1 ) A.site_id = %%DEFAULT_SITE%% GROUP BY A.value ORDER BY quan ASC 30 Date yearmonth false false Industry value Accounts quan true Sales Volume amt dol,2 true dol,2