Answer the question
In order to leave comments, you need to log in
How to solve the problem with aliases?
SELECT
`products`.*,
AVG(product_ratings.rating) AS `total_rating`
FROM
`products`
LEFT JOIN `products` ON products.id = product_ratings.product_id
WHERE
`products`.`slug` = 'organization-idorganization-idorganization-idorganization-id-1'
Answer the question
In order to leave comments, you need to log in
Add grouping to the query
GROUP BY products.id
and ask a more specific question.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question