Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Another Query Problem
Here you go Ted,
select a.cde, NVL(b.qty,0)+NVL(c.qty,0)+NVL(d.qty,0) from tbl_of_unique_string a
,(select x,count(*) qty from first_tbl group by x) b ,(select y,count(*) qty from first_tbl group by y) c ,(select z,count(*) qty from first_tbl group by z) dwhere a.cde = b.x(+)
Let me know if it gives you what you want.
Cheers,
Arnold
In article <3A259D3E.7A94DFAA_at_yahoo.ca>,
Ted Wasserman <ted_wasserman_at_yahoo.ca> wrote:
> I tried this query and I couldn't get it to work. It may be that I'm
not
> substituting in proper infd or it may be the version of SQL+ I'm using
(for
> BTW is SQL*Plus: Release 8.1.5.0.0) or if the query is somehow flawed.
I
> would appreciate if anyone else could take a look at this and see if
they
> can make sense of it all. Again, what i'm looking for is a query that
will
> return how many times each value (in this case character strings)
appear
> in 3 columns of a table. (& the additional constraint of only
returning the
> character strings (& the # of occurences) that are greater or equal to
3).
>
> Thanks Again!
>
> aqs472_at_my-deja.com wrote:
>
> > hope this should help
> >
> > select a.string, b.qty + c.qty + d.qty
> > from tbl_of_unique_strings a
> > ,(select count(*) qty from first_tbl where x = a.string) b
> > ,(select count(*) qty from first_tbl where y = a.string) c
> > ,(select count(*) qty from first_tbl where z = a.string) d
> > where b.qty + c.qty + d.qty >= 3
> >
> > cheers,
> > arnold
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Thu Nov 30 2000 - 11:29:27 CST
![]() |
![]() |