I have a query that SUMs total sales but I need to check the delivery date against the current date and make sure the SUM I display is YTD. How can I get the current date and what calculation could I perform to make sure the data is not more than one year from today? I was thinking of:
SELECT SUM(Tot_Sales) AS Expr1, Del_Date
FROM JobCost
WHERE (Del_Date < 'getdate + 1')
GROUP BY Del_Date
SELECT SUM(Tot_Sales) AS Expr1, Del_Date
FROM JobCost
WHERE (Del_Date < 'getdate + 1')
GROUP BY Del_Date