Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Question

Re: SQL Question

From: Kenny Gump <kgump_at_mylanlabs.com>
Date: Wed, 3 Feb 1999 14:03:04 -0500
Message-ID: <36b89d74.0@news.mountain.net>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US