At 09:57 04/10/2001 +0800, Osman Omar wrote: Hi! >Hi, > >I have a table like this > >model color >----------------- >135 blue >135 red >135 green >235 black >235 green >---------------- > >How do I get how many row in each distinct model >eg > >model 135 have 3 color >model 235 have 2 color
mysql> select model, count(color) from product group by model; +-------+--------------+ | model | count(color) | +-------+--------------+ | 135 | 3 | | 235 | 2 | +-------+--------------+ 2 rows in set (0.00 sec) Regards, Miguel >thanks. > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail ><[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- For technical support contracts, goto https://order.mysql.com/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Miguel A. Solórzano <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, FullTime Developer /_/ /_/\_, /___/\___\_\___/ Mogi das Cruzes - Săo Paulo, Brazil <___/ www.mysql.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php