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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Group By question

Re: Group By question

From: Jim Lyons <j.lyons_at_cc.utexas.edu>
Date: Wed, 23 Dec 1998 11:43:27 -0600
Message-ID: <36812BBF.4B32@cc.utexas.edu>


Thomas Kyte wrote:

> In order to COUNT, it needs to know what to count by - in this case, it would be
> RECORDID and WORDID. Since you want the results of a COUNT BY recordid to be
> merged with the wordid for each recordid, we can code:
>
> select a.recordid, a.cnt, b.wordid
> from ( select recordid, count(*)
> from T
> group by recordid ) A,
> T B
> where a.recordid = b.recordid
> /

One minor correction, the second line should read:

 from ( select recordid, count(*) cnt

In other words, identify that expression so Oracle will recognize a.cnt in the select list.

--

Jim Lyons                     |  Operating Systems Specialist
ACITS                         |  512-475-9331
University of Texas at Austin | j.lyons_at_cc.utexas.edu http://uts.cc.utexas.edu/~jlyons Received on Wed Dec 23 1998 - 11:43:27 CST

Original text of this message

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