Re: SQL

From: P. Larsen <petlars_at_fls.infi.net>
Date: 1998/12/14
Message-ID: <752qq6$5th$1_at_nw003t.infi.net>#1/1


How about trying stuff before you attach the keyboard? You'll see that your solution does not provide any additional groupping or limitations. Max on ONE instance (because of the group by) still yeilds the same value as without the max function.
Using the example as an INLINE from clause and then select max might help, but it wouldn't get the type. As one suggest, using SORT DESC is the easy way out.

SELECT type, count(titles.type)
FROM titles
GROUP BY titles.type
ORDER BY count(titles.type) desc;

Regards
  Peter Larsen

clifford buetikofer wrote in message <366FDEBC.D36ABED2_at_merck.com>...
>How about:
>
>select type,max(count(titles.type))
>from titles
>group by titles.type
>
>
>Sandra Calisto wrote:
>>
>> Hi!
>>
>> I'm with a problem! Can you help me?
>> Well ... imagine that you have a bookstore database and want to know
>> wich type of book (science, literature, etc) has more books!!!
>> Well I did the counting ...
>> select type, count (titles.type)
>> from titles
>> group by titles.type
>> My prob is ... how do I get the greatest type of book!
>> Can you help me, please?
>>
>> Sandra
>
>
> The contents of this message express only the sender's opinion.
> This message does not necessarily reflect the policy or views of
> my employer, Merck & Co., Inc. All responsibility for the
 statements
> made in this Usenet posting resides solely and completely with the
> sender.
Received on Mon Dec 14 1998 - 00:00:00 CET

Original text of this message