This is not specific to MySQL (probably) but I thought this wizened
community might have a definitive answer.

Take this simple grouped select:

SELECT Value1,Value2 FROM Table1 GROUP BY Value1,Value2

Value1   Value2
---------------
Joe      Red
Joe      Blue
Joe      Green
Jim      Red
Jim      Green
Jack     Blue
               
My end goal is really this:

Value1    Value2s
------------------
Joe      Red,Blue,Green
Joe      Red,Green
Jack     Blue

The normal way to do this is iterate through the table using the app's
code.

Is this possible to do in MySQL? Using MS SQL Server or Oracle, where
you can create user defined functions, I can create a function to
return the list given the group-by value - but it is atrociously slow,
far less efficient than doing it on the client code. Is there no
native SQL way to return a list of values from within a group-by
value? Seems a nice function like LIST(Value, Separator) would
complement MAX(), MIN(), and so on nicely... but it seems not to
exist.

-- Jamie


---------------------------------------------------------------------
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

Reply via email to