David Garamond <[EMAIL PROTECTED]> wrote:
> We can use SUM(), AVG(), COUNT(), etc. in GROUP clause. These are all
> numeric functions. Is it possible to use string functions as well? I
> know MIN() & MAX() can be asciibetical for string fields, but wouldn't
> this be very handy/practical?
> 
> SELECT division,
>        G_CONCAT(", ",first_name) as nicks,
>        COUNT(*) as num_nicks
> FROM employees
> GROUP BY division;
> 
> will return:
> 
> division   nicks                       num_nicks
> --------   -----                       ---------
> sales      John, David, Billy          3
> accounting David, Mickey               2
> techsupp   Alice, Bob, Dennis, John    4
> r&d        Lisa                        1
> test                                   0
> 
> Other aggregate string functions might be G_MD5(), G_MAKE_SET(),
> G_SPAM_RATING() :-)
> 
> Aggregate functions for sets might also be nifty to have sometimes.

Here you can find list of group by functions:
        http://www.mysql.com/doc/en/GROUP-BY-Functions.html



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to