Sum Query

Drunkenneo

Registered User.
Local time
Tomorrow, 01:05
Joined
Jun 4, 2013
Messages
192
Here i want to ask i have a table
amt | tax | deduc | Total
12 1.25 3
15 1.25 4

i want to run an update query where i need to take the total of amt, tax, deduc in the total fields,

Please help.
 
Last edited:
That's an easy one--don't. You shouldn't store calculated values, you should calculate them when you need them by using a query that does so. Then whenever you need the calculated value, you reference that query. That means your table should not have a field called Total.

Based on exactly what you asked for, this would be that query:

SELECT *, (amt + tax + deduc) AS Total FROM YourTableNameHere;
 
Its a nice idea, but i want it to store in separate column. which is the requirement.
 
Thanks for the suggestion, i know that is true, but i achieved what i required, thanks both of you guys for adding something to my knowledge
 

Users who are viewing this thread

Back
Top Bottom