TITLE;แสดงยอดขายทั้งปี แสดงต่อไตรมาส
SQL;drop table if exists _saleyear&
SQL;
SQL;create table _saleyear
SQL;select datedoc,year(datedoc) as xyear,sum(saleamt) as saleamt
SQL;from arcard
SQL;where (left(trtype,2) = 'AR') OR (left(trtype,2) = 'DR')
SQL;group by 2,1
SQL;order by 2,1&
SQL;
SQL;delete from _saleyear where xyear <> :m11&
SQL;
SQL;drop table if exists _saleyear1&
SQL;
SQL;create table _saleyear1
SQL;select quarter(datedoc) as mth,space(20) as fullmth,sum(saleamt) as saleamt
SQL;from _saleyear
SQL;group by 1,2&
SQL;
SQL;update _saleyear1 set fullmth = 'Quater-1' where Mth = 1&
SQL;update _saleyear1 set fullmth = 'Quater-2' where Mth = 2&
SQL;update _saleyear1 set fullmth = 'Quater-3' where Mth = 3&
SQL;update _saleyear1 set fullmth = 'Quater-4' where Mth = 4&
SQL;
SQL;select * from _saleyear1 order by Mth
SQL;
CONDITION;เลือกข้อมูลปี~YEAR~Chr~1~SELECT YEAR(CURDATE()) FROM CONFIG~
SERIES;1~FULLMTH~SALEAMT~ยอดขาย
