REPORTFORM;SA06.frf
TITLE;วิเคราะห์ขาย ยอดมูลค่าขาย ตามรหัสสินค้า
SQL;SELECT
SQL;INVCARD.ID,
SQL;INVMST.XDESC,
SQL;SUM(INVCARD.SALEPURAMT) AS SALEAMT,
SQL;SUM(INVCARD.SALEPURQTY) AS SALEQTY
SQL;FROM INVCARD 
SQL;LEFT JOIN INVMST ON INVCARD.ID = INVMST.ID
SQL;WHERE (LEFT(INVCARD.DOCNO,2) = "IV" OR LEFT(INVCARD.DOCNO,2) = "RI")
SQL;GROUP BY 1,2
SQL;ORDER BY SALEAMT DESC
CONDITION;ตั้งแต่วันที่~INVCARD.DATEDOC~Date~2~SELECT DATEDOC FROM INVCARD~
CONDITION;ตั้งแต่รหัสสินค้า ~INVCARD.ID~Chr~2~SELECT ID FROM INVMST ~INV
EXCELSQL;SELECT
EXCELSQL;INVCARD.ID AS "รหัสสินค้า",
EXCELSQL;INVMST.XDESC AS "รายละเอียดสินค้า",
EXCELSQL;SUM(INVCARD.SALEPURAMT) AS "SALEAMT",
EXCELSQL;SUM(INVCARD.SALEPURQTY) AS "SALEQTY"
EXCELSQL;FROM INVCARD 
EXCELSQL;LEFT JOIN INVMST ON INVCARD.ID = INVMST.ID
EXCELSQL;WHERE (LEFT(INVCARD.DOCNO,2) = "IV" OR LEFT(INVCARD.DOCNO,2) = "RI")
EXCELSQL;GROUP BY 1,2
EXCELSQL;ORDER BY SALEAMT DESC
