NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql question

Frank Wong frank_wong2 at informationideas.com
Tue Aug 23 10:39:28 EDT 2005


Marcin Szkudlarek wrote:

>I have a simple table like this
>
>create table numbers (user int, number int);
>insert into numbers (user, number) values (1, 1);
>insert into numbers (user, number) values (1, 9);
>insert into numbers (user, number) values (1, 5);
>
>is it possible in mysql to write a query which gives me a result (1 row):
>"1,9,5" ?
>
>Marcin
>  
>
As far as I know, that cannot be done with a single query.  Your best 
bet is to query (SELECT number FROM numbers) then programatically get 
your results to the comma delimited format you want.  It can also be 
done using stored procedures if the database you are using supports 
stored procedures.


_____________
Frank




More information about the talk mailing list