I have a complex sql select query which actually returns sales report against specified categories. I want to load data as a collection to display but I’m not able to convert the query into Magento’s equivalent getCollection statement. my query is below. thanks in advance
SELECT
distinct catalog_product_entity_varchar.value,
review_entity_summary.reviews_count,
review_entity_summary.rating_summary
FROM
catalog_product_entity_varchar
join
review_entity_summary on
catalog_product_entity_varchar.entity_id = entity_pk_value
WHERE
attribute_id = (
SELECT
attribute_id
FROM
eav_attribute
WHERE
entity_type_id = 4
AND attribute_code = ‘name’
)
order by
rating_summary ASC ;