sql query i need to add the same range for the year before MAX$15
Budget: $10 – $30 USD
i have this query that give me the data for this year i need to have last year data side with this year
begin
--This Year Sale - Daywise
SET @StartDate=DATEADD(yy, DATEDIFF(yy, 0, @OrderDate), 0)
SELECT fn.[DayName],fn.Dates,ROUND(ISNULL(SUM(oh.Total_Price),0),2) AS GrossSales, ROUND(ISNULL(SUM(oh.Grand_Total),0),2) AS NetSales
FROM fnGetListOfMonths(@StartDate,@OrderDate) fn
LEFT OUTER JOIN Invoice_Totals oh ON CAST(oh.DateTime AS DATE) = fn.Dates AND oh.Store_ID=@StoreID
GROUP BY fn.DayName,fn.Dates
begin
--This Year Sale - Daywise
SET @StartDate=DATEADD(yy, DATEDIFF(yy, 0, @OrderDate), 0)
SELECT fn.[DayName],fn.Dates,ROUND(ISNULL(SUM(oh.Total_Price),0),2) AS GrossSales, ROUND(ISNULL(SUM(oh.Grand_Total),0),2) AS NetSales
FROM fnGetListOfMonths(@StartDate,@OrderDate) fn
LEFT OUTER JOIN Invoice_Totals oh ON CAST(oh.DateTime AS DATE) = fn.Dates AND oh.Store_ID=@StoreID
GROUP BY fn.DayName,fn.Dates