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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Why using "Group By"

Re: Why using "Group By"

From: Damjan S. Vujnović <damjan_at_NO_SPAM.galeb.etf.bg.ac.yu>
Date: Thu, 13 Mar 2003 20:23:32 +0100
Message-ID: <b4qlq3$rbo$1@news.etf.bg.ac.yu>


Mikito Harakiri wrote:
> "Damjan S. Vujnovi??" <damjan_at_NO_SPAM.galeb.etf.bg.ac.yu> wrote in message
> news:b4prme$fnl$1_at_news.etf.bg.ac.yu...
>

>>How will you write (using your sintax) something like this:
>>
>>SELECT
>>   CUSTOMER_CITY, COUNT(*)
>>FROM
>>   CUSTOMER_TABLE
>>GROUP BY
>>   CUSTOMER_CITY, SOME_OTHER_CUSTOMER_TABLE_ATTRIBUTE

>
>
> select CUSTOMER_CITY, CNT from (
> SELECT
> CUSTOMER_CITY,
> SOME_OTHER_CUSTOMER_TABLE_ATTRIBUTE,
> COUNT(*) as CNT
> FROM
> CUSTOMER_TABLE
> -- implicit GBY
> )
>
>

Good point - I found it myself too, but was too late :) Also the example in your latest post seems to be quite adequate. The example I found later was quite similar:

SELECT MAX(y) AS maxcount

   FROM (SELECT COUNT(*) AS y

           FROM t
          GROUP BY x)

-- 
Regards,
Damjan S. Vujnovic

University of Belgrade
School of Electrical Engineering
Department of Computer Engineering & Informatics
Belgrade, Serbia

http://galeb.etf.bg.ac.yu/~damjan/
Received on Thu Mar 13 2003 - 13:23:32 CST

Original text of this message

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