SQL Scripts–Order Count–YTD By User
Views (6)
Following up on my last script, SQL Scripts–Order Count–Previous Week By User, this script will show you the number of orders entered by user for the current year.
***Note that you will need to make sure the @doc_date is set to January 1st of the current year***
This script uses the following views:
– Historical Sales Documents (tspvSalesDocuementHistory)
DECLARE @doc_date DATETIME
–Set @doc_date to January 1st of the current year–
SET @doc_date = ‘1/1/2010’
SELECT created_by,
[Orders_Entered] = COUNT(*)
FROM dbo.tspvSalesDocumentHistory
WHERE Doc_Date >= @doc_date
AND Sales_Doc_Type = ‘order’
GROUP BY Created_By
ORDER BY orders_entered desc
This was originally posted here.

Like
Report
*This post is locked for comments