php - GROUP_CONCAT with LEFT OUTER JOIN of two tables -


select table1.value, table2.additionalinfo table1 left outer join table2 on table1.id=table2.id 

i try output this

value   additionalinfo blah    something, somethingelse, more blah2   null blah3   stuff 

but

value   additionalinfo blah    blah    somethingelse blah    more blah2   null blah3   stuff 

i tried use group_concat , group_concat(distinct)

select group_concat(table1.value), table2.additionalinfo table1 left outer join table2 on table1.id=table2.id order table1.value 

when add group_concat , order table1.value lists 1 additionalinfo per value none of values , doesn't repeated additionalinfos. moved order around no avail.

i think need group_concat on additionalinfo column , not on table1.value

select table1.value,  group_concat(distinct table2.additionalinfo) additionalinfo table1 left outer join table2 on table1.id=table2.id  group table1.value order table1.value 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -