Adding or Substracting to a current value

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.
 
D

Daryl S

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";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top