SQL syntax to count records in related table
I have a query which looks like:
SELECT LodgeID, Lodge
FROM lodges
LEFT JOIN product_connections ON lodges.LodgeID = product_connections.LodgeIDC
INNER JOIN countries ON lodges.CountryID = countries.CountryID
WHERE Product_Type = 'Property' GROUP BY LodgeID
Which returns a basic list like this:
LodgeID, Lodge
1, Lodge A
2, Lodge B
etc
How can I add a field to the query to count the number of records each lodge had in the product_likes table?
For example, if there are five records in the product_connections table like this:
LikeID, LodgeIDC
1, 1
2, 1
3, 1
4, 2
5, 2
Lodge A has three likes.
So I would like the number of connections to be visible in the original table like this:
LodgeID, Lodge, Connections
1, Lodge A, 3
2, Lodge B, 2
I know it should probably use the COUNT function, but am just not sure how to get it to count records in the related table, rather than the main table referenced in the query.
Thanks.