1. 程式人生 > >Mysql group_concat 函式

Mysql group_concat 函式

SELECT t.id,
    t2.direction location,
    t1.NAME NAME,
    t2.question question,
    '' pattern,
    t1.NAME dimension,
    '' instruct,
    t2.answer ans,
group_concat('[[',t4.resource_url,']]') resourceUrl,
CONCAT(t2.answer,group_concat('[[',t4.resource_url,']]')) answer

from content t 
INNER
JOIN module t1 ON t.moduleID = t1.id INNER JOIN knowledgepoint t2 ON t.detailID = t2.id inner join knowledgepoint_resource t3 on t3.knowledgePointID=t.detailID inner join resource t4 on t4.id=t3.resourceID where t.relate='2' GROUP BY t.id ;
輸出:

輸出結果