Information générale
Forum:
Microsoft SQL Server
Hi Noel,
You can use a subquery to get the result that you want.
Use the following code:
select sum(Total) as Total, NAME
from (select TOTALSERVICE as Total, NAME
from table1
union all
select TOTALSALES as Total, NAME
from table2) tblresult
group by NAME
Mabuhay.....
Rene
Hi to all,
I have here two tables,
Table A Table B
TOTALSERVICE NAME TOTALSALES NAME
500 A 100 A
600 B 300 B
700 C 400 D
and wanted to produce the following output
TOTALSALESSERVICE NAME
600 A
900 B
700 C
400 D
Great ideas are very much welcome.
Looking forward for an answer.
Noel
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement