select master.pk, detail.rec_count
from table1 master, (select pk, count(*) as rec_count
from table2
group by pk) detail
where master.pk = detail.pk;
This should give you what you want.
Kenny Gump
OCP 7.3 DBA
antonio wrote in message <799ti7$uf$1_at_freyja.bart.nl>...
>Hi,
>
>I'm having some difficulties finding out the right SQL statement.
>This is the problem:
>
>I have two tables, let's say table1 and table2.
>
>table1 is the mastertable and table2 is the detail table.
>
>First I have to make a selection in the first table. Then i have to count
>the number of detailrecords.
>I want to display the selected masterrecords and the number of
>detailrecords.
>
>How can I do this?
>
>Antonio.
>
>
Received on Wed Feb 03 1999 - 13:03:04 CST