I created a query and want to do if it is possible a subquery with summary, below is my code. Is it possible. I have never done a subquery before.SELECT [GL Description], SUM(Amount) AS [Prior YTD Amount], Year, MonthFROM dbo.vlv_PriorYrDetailExpensesGROUP BY [GL Description], Year, MonthHAVING (Year = @Year) AND (Month <= @Month) I get this result using the above queryGL_Description Amount Year MonthAuto Expense 100.00 2015 1 Auto Expense 100.00 2015 2 Off. Expense 200.00 2015 1 Off.Expense 200.00 2015 2 Contract Labor 1000.00 2015 1 Contract Labor 1000.00 2015 2 Cleaning Labor 2000.00 2015 1 Cleaning Labor 2000.00 2015 2 I would like to get this result instead without the month.GL_Description Amount Year Auto Expense 200.00 2015 Off. Expense 400.00 2015 Contract Labor 2000.00 2015 Cleaning Labor 4000.00 2015 Any help will be appreciated. Thank you in advance.
↧