Skip to Content

Sales Order Row Count

Hi Experts

I want to analyse how many sales order rows are going on the system between set periods and which users are inputting the rows.

Can anyone suggest a query which will simply show me a number of how many rows each user has created for a user input period of time?

Regards

Geoff

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 20, 2011 at 05:54 PM

    Hi Geoff,

    Try:

    SELECT T2.U_Name, COUNT(T0.Linenum) LineCount

    FROM RDR1 T0

    INNER JOIN ORDR T1 ON T1.DocEntry=T0.DocEntry

    INNER JOIN OUSR T2 ON T2.UserID=T1.UserSign

    WHERE T1.DocDate >= [%0\] AND T1.DocDate <= [%1\]

    Group By T2.U_Name

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Geoff Lord

      Try:

      Declare @ToDate as datetime

      SET @TODATE = /SELECT T5.Docdate FROM ORDR T5 WHERE T5.DocDate=/ [%0\]

      SELECT DISTINCT T0.U_Name, (SELECT COUNT(T2.Linenum) FROM ORDR T1

      INNER JOIN RDR1 T2 ON T2.DocEntry=T1.DocEntry WHERE T0.UserID=T1.UserSign AND DateDiff(D,T1.DocDate,@ToDate) Between 0 AND 30) LineCount1,

      (SELECT COUNT(T2.Linenum) FROM ORDR T1

      INNER JOIN RDR1 T2 ON T2.DocEntry=T1.DocEntry WHERE T0.UserID=T1.UserSign AND DateDiff(D,T1.DocDate,@ToDate) Between 31 AND 60) LineCount2,

      (SELECT COUNT(T2.Linenum) FROM ORDR T1

      INNER JOIN RDR1 T2 ON T2.DocEntry=T1.DocEntry WHERE T0.UserID=T1.UserSign AND DateDiff(D,T1.DocDate,@ToDate) Between 61 AND 90) LineCount3

      FROM OUSR T0

  • author's profile photo Former Member
    Former Member
    Posted on Jul 20, 2011 at 05:34 PM

    Hi Goeff......

    I dont know what you require exactly but please try this.......

    SELECT Count(T0.[LineNum]), T2.U_Name FROM RDR1 T0  INNER JOIN ORDR T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OUSR T2 ON T1.UserSign = T2.USERID Where (T1.DocDate>='[%0]' and T1.DocDate<='[%1]')
    GROUP BY T2.U_Name

    Hope this may help you.........

    Regards,

    Rahul

    Edited by: RAHUL MOUNDEKAR on Jul 20, 2011 11:04 PM

    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.