Here’s my database structure:

And here’s the SQL statement I’m attempting:
SELECT
t1.Name AS Teacher_Name,
t2.Name AS Observer_Name,
o.Datetime AS Datetime,
o.Type AS Type,
o.Year_Group AS Year_Group,
o.Class_Name AS Class_Name,
c.Title AS Course_Name,
GROUP_CONCAT(f.Focus_ID) AS Focus,
o.Achievement_Grade AS Achievement_Grade,
o.Behaviour_Grade AS Behaviour_Grade,
o.Teaching_Grade AS Teaching_Grade,
o.Notes AS Notes
FROM observations o
INNER JOIN teachers t1 ON o.Teacher_ID = t1.Teacher_ID
INNER JOIN teachers t2 ON o.Observer_ID = t2.Teacher_ID
INNER JOIN courses c ON o.Course_ID = c.Course_ID
INNER JOIN foci f ON f.Observation_ID = o.ID
ORDER BY `Datetime` DESC LIMIT 0,10
What I’m trying to achieve is, within the above statement, to retrieve a list of Foci with a , separator such as Appraisal,Post 16,Teaching and Learning.
This would be achieved by retrieving every row in the Foci table where Foci.Observation_ID meets Observations.ID and then retrieving the name of each focus from Focus_Labels.Title if Foci.Focus_ID matches Focus_Labels.ID.
In the statement above I didn’t get as far as trying to retrieve Focus_Labels.Title because I couldn’t even get the Foci.ID working.
Can anyone help?
I would suggest a slight change from an
INNER JOINto aLEFT JOINbecause unless you are certain rows exist in all tables, you will not return results: