Adding or Substracting to a current value

  • Thread starter Thread starter kikeman
  • Start date Start date
K

kikeman

Hi,

I have a table with a column "Hrs" that is a double type.

I would like to add or substract hours to the current value with a single
UPDATE command. i.e:

Orders Hrs
Q6E4D3 2.5

I would need to add 3.5 hrs:

Orders Hrs
Q6E4D3 6.0

What would be the SQL UPDATE command to do this?

Thanks,
kikeman.
 
Kikeman -

If you want to only update the one record, you will need the WHERE clause.
If you remove the WHERE clause, it will add 3.5 hours to every record in the
table. You can change the WHERE clause to limit the records you want to add
3.5 hours to.

UPDATE TableName
SET [HRS] = [HRS] + 3.5
WHERE ORDERS = "Q6E4D3";
 
Back
Top