Better way to sum columns and add value to another column?

I have a similar question about adding several columns to another column, but mine are decimals instead. But I would like to do just a query inside of the database itself. Is it possible?

Here is my scenario:

UPDATE operating_expenses
SET Total = Fuel+Oil_Change+Tire_Repairs+Parts+Insurance+License_Fees+Toll+Misc
WHERE OE_ID = OE_ID

It adds up but the Total column comes up with a different result lower than the real total.

Can this be done within the query from mysql?

Thanks.

You also should not be trying to create a column to store information that you can derive from other columns in your table already.

I´m been using Dreamweaver and this query has been entered into the update form on the server behavior.

What are you suggesting them, that this query be place inside of the database??? I’m a nubby to this. Hope you understand.

Any other suggestion,

thanks in advance.

SELECT Fuel
     , Oil_Change
     , Tire_Repairs
     , Parts
     , Insurance
     , License_Fees
     , Toll
     , Misc
     , Fuel + Oil_Change + Tire_Repairs + Parts + 
       Insurance + License_Fees + Toll + Misc [COLOR="Blue"]AS Total[/COLOR]
  FROM operating_expenses

ur doing it wrong :smiley: :smiley:

Thanks for you very speedy repply. But that did not work, but I had played around with other elements as you see below and it worked, BUT???
Now the problem is that I have to send the UPDATE form twice before it actually makes the changes into the database. Do you know why???

this was your code—

SELECT Fuel
     , Oil_Change
     , Tire_Repairs
     , Parts
     , Insurance
     , License_Fees
     , Toll
     , Misc
     , Fuel + Oil_Change + Tire_Repairs + Parts + 
       Insurance + License_Fees + Toll + Misc AS Total
  FROM operating_expenses

this code works

SELECT OE_ID, Date_, Trip_No, Fuel, Oil_Change, Tire_Repairs, Parts, Insurance, License, Toll, Misc,
SUM(Fuel+Oil_Change+Tire_Repairs+Parts+Insurance+License+Toll+Misc) AS Total
FROM operating_expenses
WHERE OE_ID = colname

thanks again for the help.

Best Regards…

Update form? What update form?
And there is no UPDATE in these last 2 queries you posted :shifty: