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: Chris Aiello <caiell02_at_comcast.net>
Date: Tue, 27 Aug 2002 01:59:04 GMT
Message-ID: <I1Ba9.216328$m91.9001657@bin5.nnrp.aus1.giganews.com>


Guys:
Thanks so much for your insights. If you could let me know one thing. Did anyone refer to a book for this? Or were you able to figure it out. I'm something of a novice and if there is any additional detail on how the query works, I'd love to see it. Either way, I'm printing all of this right now, and am attacking. Once again, thanks.
"Sergey Adamenko" <adamenko_at_i.com.ua> wrote in message news:ake2kg$12hp$1_at_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 - 20:59:04 CDT

Original text of this message

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