I am trying to get the result of the MySQL SUM function and copy it into a table.
The code I am working with is below:
SELECT SUM(TAX) AS @TTax FROM Invoices01;
update Invoices01 set EXTRA1 = @TTax;
This code does not work.
If you have any suggestions in would be great.
Mike
Hey @mdsmith1!
There's some good info on declaring MySQL variables in this StackOverflow post.
Can you try the following and let us know if that works?
SELECT @TTax:=SUM(TAX) FROM Invoices01;
update Invoices01 set EXTRA1 = @TTax;
Henry:
It worked !!!
Thank you so much.
I will mark this as the solution.
Thanks again.
Mike