The SQL statement:CREATE TABLE #DonationsThisYear(Solicitor nvarchar(8), SumPayment bigint, CountPayment int)INSERT INTO #DonationsThisYear SELECT FamilyDonationHistory.Solicitor AS Solicitor, SUM(FamilyDonationHistory.PaymentAmt) AS SumPayment, COUNT(FamilyDonationHistory.PaymentAmt) AS CountPayment FROM FamilyDonationHistory WHERE (DepositDate < @today) AND ((right(Event, 2)) = right(@year, 2)) AND (left(Event, 2) <> 'TR') GROUP BY Solicitor, SumPayment, CountPayment
The errors:Server: Msg 207, Level 16, State 3, Line 3Invalid column name 'SumPayment'.Server: Msg 207, Level 16, State 1, Line 3Invalid column name 'CountPayment'.Server: Msg 207, Level 16, State 1, Line 3Invalid column name 'SumPayment'.Server: Msg 207, Level 16, State 1, Line 3Invalid column name 'CountPayment'.
What's the deal? I don't see what the problem is here...