Posted: 7/5/2011
I am trying to insert the SUM of a column from one table into a field of a different table.
INSERT INTO [ChangeDue] ([PatmentAmount], [TotalDue]) VALUES (@PatmentAmount,@TotalDue)
ToatlDue is actually the SUM of a column called ItemTotal from my Receipts TABLE. How can I do that?
thanks in advance
Hi Mike,
Use SELECT statement to get totals, like this
INSERT INTO [ChangeDue]([PatmentAmount],[TotalSum]) SELECT [PatmentAmount], SUM([ItemTotal]) as [TotalSum] FROM [Receipts] GROUP BY PatmentAmount;
Gjorgji