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: to all SQL experts...

Re: to all SQL experts...

From: Sergey Adamenko <adamenko_at_i.com.ua>
Date: Mon, 26 Aug 2002 22:56:31 +0300
Message-ID: <ake2kg$12hp$1@news.dg.net.ua>

"Martin Haltmayer" <Martin.Haltmayer_at_d2mail.de> ???????/???????? ? ???????? ?????????: news:3D6A0B20.3C33BCB5_at_d2mail.de...
> Hi Sergey,
>
> thank you for your check. I gave a wrong answer. What about
>
> select t1.col1, x.col1t as col2
> from
> (
> select t1.col1, count (*) as t1num
> from testtab t1
> group by t1.col1
> ) t1
> , (
> select t1.col1, t2.col1 as col1t, count (*) as xnum
> from testtab t1, testtab t2
> where t1.col2 = t2.col2
> and t1.col1 < t2.col1
> group by t1.col1, t2.col1
> ) x
> where t1.col1 = x.col1
> and t1.t1num = x.xnum
> order by 1, 2
> /
>
> At least this gives the correct results for your testcase and the original
one.
> And now the logic behind it seems correct.
>
> Martin

Seems to be OK.
It'll work with primary key(col1, col2) on the table.

Sergey. Received on Mon Aug 26 2002 - 14:56:31 CDT

Original text of this message

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