Example of how to do a SQL Server YTD Summary from a Table
Posted on 2004-08-18
This is urgent.
I need a (Best Practice) example of a function on how to do a YTD Summary from a SQL Server Table from an Asp.net web form using VB. I will then need to place them into 3 variables: YtdHrs, YtdQty and Ytd(OnOrder)
The query I would use would be:
SELECT Sum(Hrs), Sum(Qty), Sum(OnOrder) From Orders Where EnterDate > #12/31/2003#
(I'm not sure if my date syntax is correct. Please correct me if its wrong)
Of particular importance to me is how to extract the information from the returned dataset and placing them into the variables.