I seem to be doing something wrong in one of my queries. There are 3 tables:
Table structure simplified
id | id_doc | title
id_doc | analyst_id
analyst_id | analyst_name
I am trying to display a result that looks like this:
id | id_doc | title | analyst_name
My query is bellow and it gives me more rows than expected (I guess I am making up rows as I go along...) unfortunatly I am not so great with left joins, any help is much appreciated!
SELECT docs.ida, docs.Id_Document, docs.Title, analyst.name AS Analyst_Name
FROM Documents AS docs
LEFT JOIN Documents_Analyst_Mapping AS analyst_map ON docs.Id_Document = analyst_map.Id_Document
LEFT JOIN Documents_Analyst AS analyst ON analyst_map.Analyst_Id = analyst.Analyst_Id
WHERE analyst_map.Analyst_Id = analyst.Analyst_Id
AND docs.Language = 'en'