Link to home
Start Free TrialLog in
Avatar of fcobuzzi
fcobuzzi

asked on

How to subtract data in columns

Hi,

I would like to do the following operation.

Col A- Col B and then put result in Col C.  All the columns are from the same table.

The values are numeric it would be something like this:
Col A - Col B = Col C
    11 - 7      = 4

TIA,
Frank
Avatar of rafrancisco
rafrancisco

Try this:

UPDATE YourTable
SET ColC = ColA - ColB
Avatar of fcobuzzi

ASKER

I have already tried that here is the message that I get, maybe it will help.
 
Invalid operator for data type. Operator equals subtract, type equals varchar.


Frank
This means that one of your columns (either ColA or ColB) is a varchar.
All three columns are varchar.
ASKER CERTIFIED SOLUTION
Avatar of rafrancisco
rafrancisco

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the quick help.