Skip to Content
0

Help with SQL Query

May 09 at 06:42 AM

41

avatar image

sap-comm.pngHi All,

Can you guys help me in building query for the below requirement,

We need gross profit analysis report on monthly basis, The client gets to choose the dates and as per the dates, the details should be displayed

Item group name, beg inventory, end inventory, purchase, sales, cost of sales, Gross profit, % cost, % Gross profit.

Below is the query that I worked on

SELECT DISTINCT T0."AcctName",SUM(T1."Credit") + SUM(T1."Debit") AS "Inventory" ,SUM(T1."Debit") AS "Purchase", SUM(T1."Credit") AS "Sales" FROM OACT T0 INNER JOIN JDT1 T1 ON T0."AcctCode" = T1."Account" WHERE T0."AcctCode" LIKE '121%' AND (T1."RefDate" >= [%0] AND T1."RefDate" <= [%1]) GROUP BY T0."AcctName", T0."CurrTotal"

I have attached a screenshot of what is required in the report

Please let me know

sap-comm.png (206.5 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers