REPORTFORM;xxtest.frf
TITLE;
SQL;SELECT xorder.ID,xorder.XDESC,ordhead.ACCID,armst.XCOMP, 
SQL;IF(MONTH(xorder.DATEDOC) = 4, SUM(xorder.QUAN),0) AS Last3, 
SQL;IF(MONTH(xorder.DATEDOC) = 5, SUM(xorder.QUAN),0) AS Last2, 
SQL;IF(MONTH(xorder.DATEDOC) = 6, SUM(xorder.QUAN),0) AS Last1
SQL;FROM xorder
SQL;LEFT JOIN ordhead ON xorder.DOCNO = ordhead.DOCNO
SQL;LEFT JOIN armst ON ordhead.ACCID = armst.ACCID
SQL;GROUP BY 1,2,3,4
SQL;ORDER BY 3,1
CONDITION;Ле~YEAR(XORDER.DATEDOC)~Chr~1~~
