查询

select incident.incidentID,
GROUP_CONCAT(moccode2.Description) as MOC2Description
from incident
join incidentmoc on incident.IncidentID = incidentmoc.IncidentID
inner join moccode2 on moccode2.id = incidentmoc.moccodeid
where incident.IncidentID=962
group by moccode2.Description


结果:

incidentID, MOC2Description
962, Therapist
962, Obscentiy


我要做什么

incidentID, MOC2Description
962, Therapist, Obscentiy

最佳答案

您需要改为按incident.incidentID分组。

09-20 09:25