Skip to Content

Help with SQL Query

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers