Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

GROUP BY on multiple tables

$
0
0
Hello all,

I have 2 tables with a common key resembling:

Table A
Key No. of Lines (result of a count(*) group by key)
A 12
B 40
C 33
D 45
E 60

Table B
Key No. of Lines (result of a count(*) group by key)
B 12
C 39
D 44
F 65

What I need is a full outer join on these two tables so as to produce a result set resembling:

Key No. of lines in Table A No. of lines in Table B
A 12 0
B 40 12
C 33 39
D 45 44
E 60 0
F 0 65

I seem to be unable to do a full outer join and then execute a count(*) on the separate tables.

Can someone please help me?

Thanks a lot

S. BASU

Viewing all articles
Browse latest Browse all 13329

Trending Articles