Michael Stassen wrote:

Stano Paska wrote:

Hi,

it is possible to <subj>?

I have two tables.
create table aaa (id int auto_increment not null, title varchar(255), primary key (id));
create table bbb (id int auto_increment not null, fk_aaa int not null, detail varchar(255), primary key (id));
insert into aaa values (1, 'aaa'), (2, 'bbb');
insert into bbb values (1, 1, '123'), (2, 1, '456'), (3, 2, '789');


I need display table aaa with last column concat values from bbb. Like this:
| 1 | 'aaa' | '123 456' |
| 2 | 'bbb' | '789' |


It is possible with version 4.1.x? Or I must upgrade to 5.0.x and use stored procedures?


Stano.


In general, you can simply have your app output a newline, id, and title only when the id changes.

Starting with 4.1, you can get the same result using GROUP_CONCAT(). See the manual for the details <http://dev.mysql.com/doc/mysql/en/group-by-functions.html>.

Michael

Yes, this is what I need. I didn't read this part of manual. :-(
Thank you.

S.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to