[Solved] SQL request with JOIN and COUNT
If I am reading your question right, the result table give you the age ID and Period, and then the count of toys per age ID and Period. Here is how you would write that query: SELECT Ages.ID, Ages.Period, IFNULL(sub.cnt,0) AS Count FROM Ages LEFT JOIN (SELECT Toys.age_id, COUNT(*) AS cnt FROM Toys GROUP BY … Read more