patrick
patrick

Reputation: 16979

MySQL group by help simple example sql noob

The Query

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

The results:

incidentID, MOC2Description
962, Therapist
962, Obscentiy

What I'm shooting for

incidentID, MOC2Description
962, Therapist, Obscentiy

Upvotes: 0

Views: 85

Answers (1)

Marc B
Marc B

Reputation: 360772

You need to group on incident.incidentID instead.

Upvotes: 3

Related Questions