Friday, 15 May 2015

mysql - querying 2 tables -



mysql - querying 2 tables -

good day, have problem in querying in 2 mysql table.

table 1

c_id c_name **-----------------** 1 blah,blah 2 hey

table 2

m_id c_id m_name ----------------------- 1 1 some_name 2 1 some-name 3 1 some/name 4 1 some.name 5 2 name.some 6 2 name-some

i wanted display this:

c_id c_name m_name ----------------------------- 1 blah,blah some_name some-name some/name some.name 2 hey name.some name-some

select a.c_id, a.c_name, group_concat(b.m_name separator '<br/>') m_name table1 left bring together table2 b on a.c_id = b.c_id grouping a.c_id;

fiddle

use m_name bind label. come line breaks

mysql sql

No comments:

Post a Comment