REPORTFORM;SA01.frf
TITLE;วิเคราะห์ขายตามยอดขายพนักงาน
SQL;SELECT
SQL;INVCARD.SALEID,
SQL;SALEMST.SNAME,
SQL;SUM(INVCARD.SALEPURAMT) AS SALEAMT,
SQL;SUM(INVCARD.SALEPURQTY) AS SALEQTY
SQL;FROM INVCARD LEFT JOIN SALEMST
SQL;ON INVCARD.SALEID = SALEMST.SID
SQL;WHERE (LEFT(INVCARD.DOCNO,2) = "IV" OR LEFT(INVCARD.DOCNO,2) = "RI")
SQL;GROUP BY 1,2
SQL;ORDER BY 3 DESC
CONDITION;ตั้งแต่วันที่~INVCARD.DATEDOC~Date~2~SELECT DATEDOC FROM INVCARD ~
CONDITION;ตั้งแต่รหัสพนักงาน ~INVCARD.SALEID~Chr~2~SELECT SID FROM SALEMST ~SALE
EXCELSQL;SELECT
EXCELSQL;INVCARD.SALEID AS "รหัสพนักงาน",
EXCELSQL;SALEMST.SNAME AS "ชื่อ - สกุล",
EXCELSQL;SUM(INVCARD.SALEPURAMT) AS "ยอดขาย",
EXCELSQL;SUM(INVCARD.SALEPURQTY) AS "จำนวนขาย"
EXCELSQL;FROM INVCARD LEFT JOIN SALEMST
EXCELSQL;ON INVCARD.SALEID = SALEMST.SID
EXCELSQL;WHERE (LEFT(INVCARD.DOCNO,2) = "IV" OR LEFT(INVCARD.DOCNO,2) = "RI")
EXCELSQL;GROUP BY 1,2
EXCELSQL;ORDER BY 3 DESC
