Re: HELP!: How to get 0 COUNT values from a join
Date: 24 Aug 1993 03:12:22 -0500
Message-ID: <CC980r.Gyu_at_uk.ac.brookes>
andrew_at_ccc.govt.nz wrote:
> Hi folks,
> Here's the situation:
> create table source ( ..., mesh_source, ... );
> create table target ( ..., mesh_target, ... );
> I've tried:
> select
> source.mesh_source,
> count(*)
> from
> source,
> target
> where
> source.mesh_source = target.mesh_target
> group by
> source.mesh_source;
> What I want is:
> SOURCE.MESH_SOURCE COUNT(*)
> ------------------ --------
> 2134500 12
> 2367000 34
> 2891200 0 ( No corresponding values in "target" )
> 2397900 219
> Can this be done ??? *Any* solution(s) would be welcome.
Haven't tried it, but this should work:
select source.mesh_source, count(*)
from source, target
where source.mesh_source = target.mesh_target(+)
group by source.mesh_source;
> Cheers
> Andrew
-- _________________________ ________________________________ / Tommy Wareing \ / Dying ain't much of a living, \ | p0070621_at_brookes.ac.uk X When you're out and on the run,| \ 0865-483389 / \ Dying ain't much of a living, | ~~~~~~~~~~~~~~~~~~~~~~~~~ \ When you're young / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Received on Tue Aug 24 1993 - 10:12:22 CEST