How to have the sum of 2 tables in one row? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to have the sum of 2 tables in one row?

I am working on a project in Java using SQL queries. I am stuck in finding the sum of 2 different column of a table in a query. should I use join or sql1, sql2 in the try and catch?

14th Sep 2017, 2:39 AM
Wilbert Denis
Wilbert Denis - avatar
4 Answers
+ 9
u mean u r doing database connectivity using MySQL & JAVA , //one more thing that u can't find sum of tables ... might u mean that u want to find sum of particular columns of a same table or from two different tables //i hv an idea for doing that // firstly take out the column of a particular record from both the tables //then simple add them //note : but if u want for all records at the same time then no idea
14th Sep 2017, 5:19 AM
Changed
Changed - avatar
+ 2
can you elaborate your question plz
14th Sep 2017, 5:07 AM
vishal jain
+ 2
You cannot sum tables, you sum fields (columns), JOIN mix fields from several tables, does not sum anything either, can you give more details on what it is you're trying to achieve?
14th Sep 2017, 8:43 AM
Ipang
0
Hi I would try: answer= (sum column A)+(sum column B)
22nd Sep 2017, 7:23 PM
JT Potgieter