ixxalnxxi
09-15-2009, 08:03 AM
Hello All,
I have this query, which only pulls out one record:
SELECT locations.*,
COUNT(location_reviews.lrrating) AS rating_count,
AVG(location_reviews.lrrating) AS rating,
locations.lid AS id,
FROM (locations)
LEFT JOIN location_reviews ON location_reviews.locations_lid = locations.lid
However when I remove the COUNT and AVG functions, the query correctly pulls out 9 records. The one record being retrieved has a child row in location_reviews, the rest do not. How can I manipulate this query so that all 9 records are pulled out regardless if there are any child rows for locations?
I have this query, which only pulls out one record:
SELECT locations.*,
COUNT(location_reviews.lrrating) AS rating_count,
AVG(location_reviews.lrrating) AS rating,
locations.lid AS id,
FROM (locations)
LEFT JOIN location_reviews ON location_reviews.locations_lid = locations.lid
However when I remove the COUNT and AVG functions, the query correctly pulls out 9 records. The one record being retrieved has a child row in location_reviews, the rest do not. How can I manipulate this query so that all 9 records are pulled out regardless if there are any child rows for locations?