2
I am a beginner in programming and I would like to know how to add values of 1 column in 2 tables, both with the same data. Just rename the table...
For example:
Table teste1
:
nome | pontos |
Joao | 10 |
Table teste2
:
nome | pontos |
Joao | 10 |
I want you to come back like this:
Nome | Total
Joao | 20
I tried to use JOIN
, UNION
, UNION ALL
and I can’t...
I used:
SELECT nome AS nome, pontos AS total from teste1 where nome = 'Joao'
UNION ALL
SELECT nome AS nome, pontos AS total from teste2 where nome = 'Joao'
To which my return is:
nome | total
Joao | 10
Joao | 10
How to return the total of this query: 10 + 10
?
You’ve helped me a lot, thank you very much!!!
– Angelo Soares