yea.. almost. but it helped a lot. now i know about those functions too. thank you...


Nathan Sullivan wrote:
I think you want to do something like this:

select prod, group_concat(category separator ', ')
from products
group by prod;


Hope this helps.

On Wed, Apr 07, 2010 at 08:37:04AM -0700, kalin m wrote:
hi all...

i have a bit of a problem with this:

table products:

----------------------
prod  |  category |
---------------------|
boots |  winter    |
boots | summer  |
boots | spring     |
shoes | spring     |
shoes | winter    |
shoes | fall         |
shoes | summer  |
----------------------

when i do this:
> select distinct prod as m, (select category from products where email = m) as n from products;

i get:

ERROR 1242 (21000): Subquery returns more than 1 row

i know that the subquery returns more than one rows. i hope so...

what i'd like to see as result is:

-------------------------------------------------
m         | n                                             |
-------------------------------------------------
boots   |  winter, summer, spring          |
shoes   |  spring, winter, fall , summer  |
-------------------------------------------------


or at least:

---------------
m         | n  |
---------------
boots   |  3  |
shoes   |  4  |
----------------




thanks....





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=nsulli...@cappex.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to