• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1609
  • Last Modified:

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!
0
deanparkr
Asked:
deanparkr
2 Solutions
 
sdstuberCommented:
select column1, column2, column1 + column2  total from your_table
0
 
HoggZillaCommented:
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now