Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

sql select sum per field form 2 tables

$
0
0

Hi all,

I have my data stored in 2 tables, year 1 and year2.
I want to have the totals per destination, per customer, per year.

customer   dest     turnover Table1     turnover Table2
1           JNB             100                       0
2           JNB             200                       300
1           DUR             0                         50
1           DUR             10                        60


output needed
dest:                       year1    year2
       DUR
       customer1             10       110
       customer2             0        0

       JNB
       customer1             100      0
       customer2             200      300

Can somebody help me please how to make the select string?

Thanks in advance

Jan Prins


Viewing all articles
Browse latest Browse all 1350

Trending Articles