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!
deanparkrAsked:
Who is Participating?
 
sdstuberConnect With a Mentor Commented:
select column1, column2, column1 + column2  total from your_table
0
 
HoggZillaConnect With a Mentor Commented:
SELECT 100 + 500 FROM DUAL;
SELECT COLA + COLB FROM TABLE
0
 
deanparkrAuthor Commented:
really?  that simple!  

Thanks!
0
 
SharathData EngineerCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.