Re: SQL Brain Teaser

From: Saad Ahmad <sahmad_at_mfa.com>
Date: 1995/09/21
Message-ID: <43s0fg$bp0_at_homer.alpha.net>#1/1


Robert W. Swisshelm (swisshelm_at_lilly.com) wrote:
> You can do this in sqlplus using the BREAK and COMPUTE commands. I assume
> that many other reporting tools also can do summarizations like this.
> SQL> break on report
> SQL> compute sum of grant_count on report
> SQL> select grantee, count(*) grant_count
> 2 from dba_role_privs
> 3 where grantee like 'S%'
> 4 group by grantee;

select table_name, count(*)
from cols
group by table_name
having ( count(*) = ( select max(count(*))

                      from   cols
                      group  by table_name 
                    )
       );

--
**************************************************************
*                          Saad Ahmad                        *
*                          McHugh Freeman & Associates, Inc. *
*                          Ph:  (414) 798-8606 Ext. 457      *
*                          Fax: (414) 798-8619               *
*                          E-Mail: sahmad_at_mfa.com            *
**************************************************************
Received on Thu Sep 21 1995 - 00:00:00 CEST

Original text of this message