Skip to Content

grouping results in stock transfer query

I've made a query to display all items transferred according to some document numbers we're interested in investigating. How can we modify the query to group the items by name with a total count?

This is what I have so far:

SELECT T1.[Quantity], T1.[ItemCode], T2.[ItemName], T1.[WhsCode] FROM OWTR T0 INNER JOIN WTR1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] WHERE T0.[DocNum] IN (13,23,29,49,55)

Any help is appreciated!

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Oct 20, 2018 at 04:24 PM

    SELECT SUM(T1.[Quantity]), T1.[ItemCode], T2.[ItemName], T1.[WhsCode] FROM OWTR T0 INNER JOIN WTR1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] WHERE T0.[DocNum] IN (13,23,29,49,55) GROUP BY

    T1.[ItemCode], T2.[ItemName], T1.[WhsCode]
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 22, 2018 at 07:47 AM

    Thanks Hrvoje. That worked.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.