Counts from Multiple Tables!!

wxdqz

New Member
Hi Guys,
I have having real trouble in counting number of matches across tables...

Here is my tabke structure.

Table 1: tktab

column = id
column = code

Table 2 : multab

column = id
coulmn = tcd

The data is of the format..

Table 1:
row 1 = 20A1,20
row 2 = 20A2,20
row 3 = 25A1,25

Table 2:
row 1 = 20A2,11
row 2 = 20A2,15
row 3 = 25A1,90
row 4 = 25A1,101

Now i want to fetch the count of "id" from tktab + count of "id" from multab,code from tktab where id from tktab = id from multab and the result has to be ordered by code from tktab.

All this has to be fetched in a single query.

The result for the above fields would be

4,20
3,25

Thanks in Advance,
Danny !!

Note: Database is PostGreSQL
 
Back
Top