Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Group By question
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-9331University 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