I have little problem with mysql query. I need something like GROUP_CONCAT in GROUP_CONCAT. LOOK:
Database design :

SELECT cid, country, capital,
GROUP_CONCAT(DISTINCT mid, '=',city SEPARATOR '|*|') AS data
FROM t1
INNER JOIN t2 ON t2.c_id = t1.cid
INNER JOIN t3 ON t2.c_id = t3.mid
WHERE t1.cid =1
Return
[cid] => 1
[country] => France
[capital] => Paris
[data] => 1=Lyon|*|2=Chartres|*|3=Valence
But I want join to this query table t4 (I haven’t idea how to do this) and it will be good if output will be looks like this
[cid] => 1
[country] => France
[capital] => Paris
[data] => 1=Lyon=|*|2=Chartres=Max#Alex#Frank|*|3=Valence=John
ps.
t4.m_id = t3.mid
I am not exactly sure why you would want to do this in SQL, but here is a version that returns the desired result:
See SQL Fiddle with Demo
Result: