Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shipment Summary

Status
Not open for further replies.

dtmb

Technical User
Jan 22, 2007
54
JM
This is a query I created from invdat

SELECT ICSHIPD.FMTITEMNO, ICSHIPD.ITEMDESC, ICSHIPD.SHIPQTY, ICSHIPD.STOCKUNIT, ICSHIPD.UNITCOST, ICSHIPD.SHIPCOST, ICSHIPD.ICACCT, ICSHIPH.FISCYEAR, ICSHIPH.FISCPERIOD, ICSHIPH.CUSTNO, ICSHIPH.CUSTNAME, ICSHIPD.EXPRICEHM FROM ICSHIPD ICSHIPD, ICSHIPH ICSHIPH WHERE ICSHIPD.DAYENDSEQ = ICSHIPH.DAYENDSEQ AND ICSHIPD.TRANSSEQ = ICSHIPH.TRANSSEQ AND ((ICSHIPH.FISCYEAR='2007') AND (ICSHIPH.FISCPERIOD=5)) ORDER BY ICSHIPH.CUSTNO, ICSHIPD.ICACCT, ICSHIPD.ITEMDESC

Each customer orders each product about 20 times per period, how can I get the query to select the itemdesc only once for each customer and summarize the shipqty and the shipcost for that particular itemdesc

Thanks in advance for your assistance.
 
Code:
SELECT ICSHIPD.FMTITEMNO, ICSHIPD.ITEMDESC, Sum(ICSHIPD.SHIPQTY) AS SumOfSHIPQTY, ICSHIPD.STOCKUNIT, Sum(ICSHIPD.UNITCOST) AS SumOfUNITCOST, Sum(ICSHIPD.SHIPCOST) AS SumOfSHIPCOST, ICSHIPD.ICACCT, ICSHIPH.FISCYEAR, ICSHIPH.FISCPERIOD, ICSHIPH.CUSTNO, ICSHIPH.CUSTNAME, ICSHIPD.EXPRICEHM
FROM ICSHIPH INNER JOIN ICSHIPD ON (ICSHIPH.TRANSSEQ = ICSHIPD.TRANSSEQ) AND (ICSHIPH.DAYENDSEQ = ICSHIPD.DAYENDSEQ)
GROUP BY ICSHIPD.FMTITEMNO, ICSHIPD.ITEMDESC, ICSHIPD.STOCKUNIT, ICSHIPD.ICACCT, ICSHIPH.FISCYEAR, ICSHIPH.FISCPERIOD, ICSHIPH.CUSTNO, ICSHIPH.CUSTNAME, ICSHIPD.EXPRICEHM
HAVING (((ICSHIPH.FISCYEAR)="2007") AND ((ICSHIPH.FISCPERIOD)=5))
ORDER BY ICSHIPH.CUSTNO, ICSHIPD.ICACCT, ICSHIPD.ITEMDESC;
 
Thanks, getting the folowin error(s)

SQL query cannot be presented graphically

and

Syntax error
 
Where are you running the query?
Access, SQL Server, Pervasive?
 
Check the syntax for SQL Server, the query I did is for MS Access. The basic query remains the same.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top