On Wed, 2010-04-07 at 11:37 -0400, 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 | > ------------------------------------------------- >
I think you want: select prod as m, group_concat(category) as n from products group by prod; hth Nigel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org