L
L
Lavrov952021-03-29 23:00:14
SQL
Lavrov95, 2021-03-29 23:00:14

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

1 answer(s)
B
Bogdan Erolskiy, 2021-03-29
@B-Erolskiy

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 question

Ask a Question

731 491 924 answers to any question