group concat - mysql GROUP_CONCAT(query) -


i'm trying run query looks like:

select   group_concat(vehicles.id)                                                                    vehicles                                                                                          cars.id = vehicles.id 

brings right data:

1,2,3 

however, want brand name using group_concat

select   group_concat(select brand_name brands vehicles.id = brand.id)                                                                   vehicles                                                                                          vehicles.id = 100 

so can 'brand1', 'brand2', 'brand3'

try

select   group_concat(brands.brand_name)                                                                   vehicles  inner join brands on vehicles.id=brands.id   inner join cars on cars.id=vehicles.id                                                                                        cars.id = vehicles.id 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -