deanparkr
asked on
Is it possible to do addition in SQL
Hi,
Quick Q as I cant find much in books / google. If I wanted to add two columns together how would I do that in SQL?
1 plus 1 = 2
Where 1 is is column 1, the other 1 is column 2 and the answer is in the "total" column.
If it is possible what would the syntax look like?
Thanks!
Quick Q as I cant find much in books / google. If I wanted to add two columns together how would I do that in SQL?
1 plus 1 = 2
Where 1 is is column 1, the other 1 is column 2 and the answer is in the "total" column.
If it is possible what would the syntax look like?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What exactly you want to add?
SELECT ColA + ColB FROM YourTableI
f ColA and ColB are numaric, you will get the sum. If anyone of them is Alpha-Numaric, it will concatinate both columns. Do you want the numaric data also to be concatinated? like 10 and 20 to be as 1020
SELECT ColA + ColB FROM YourTableI
f ColA and ColB are numaric, you will get the sum. If anyone of them is Alpha-Numaric, it will concatinate both columns. Do you want the numaric data also to be concatinated? like 10 and 20 to be as 1020
ASKER
Thanks!