NYCPHP Meetup

NYPHP.org

[nycphp-talk] mysql question

Chris Shiflett shiflett at php.net
Tue Aug 23 09:42:59 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"?

Well, it sounds like you're wanting:

SELECT number
FROM   numbers

That will give you the values in the number column. Of course, you can't 
have three values in a single row when you only have two columns, so I 
might not be answering you correctly. If so, can you clarify?

Chris

-- 
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/



More information about the talk mailing list